CREATE TRIGGER dbo.haschanged --Any Trigger name
ON [table]
after UPDATE
AS
BEGIN
SET nocount ON;
DECLARE @Old VARCHAR(100),
@New VARCHAR(100)
SELECT @New = i.[col]
FROM inserted AS i
SELECT @Old = d.[col]
FROM deleted AS d
IF @New <> @Old
BEGIN
--Field was changed
END
ELSE
BEGIN
--Field was not changed
END
END
OR
CREATE TRIGGER dbo.haschanged --Any Trigger name
ON [table]
after UPDATE
AS
BEGIN
IF UPDATE (col)
BEGIN
--Field was changed
END
ELSE
BEGIN
--Field was not changed
END
END
world wide web development problems asp net php html xhtml css javascript jquery w3dproblems
Tuesday, August 27, 2013
Insert / Update image into SQL Server database using query (not front end application)
Using Insert
INSERT INTO [table]
(COLUMN)
SELECT *
FROM OPENROWSET(BULK N'Path to file', single_blob) AS [File]
Using Update
UPDATE [table]
SET [column] = (SELECT *
FROM OPENROWSET(BULK N'Path to file', single_blob) AS
[File])
--Conditions if any
INSERT INTO [table]
(COLUMN)
SELECT *
FROM OPENROWSET(BULK N'Path to file', single_blob) AS [File]
Using Update
UPDATE [table]
SET [column] = (SELECT *
FROM OPENROWSET(BULK N'Path to file', single_blob) AS
[File])
--Conditions if any
Monday, August 26, 2013
Hide custom errors asp net
<configuration> ....... <system.web> ...... <customErrors mode="Off"/> </system.web> </configuration>
Note: "mode values are case sensitive"
jQuery how to check html input checkbox state
$("input[type=checkbox]").change(function () { var isChecked = this.checked; if (isChecked) { //rest goes here } });
How to check if a string is null or empty (length 0) sql server
First convert empty value to null using "nullif" then use "isnull" to switch
SELECT Isnull(NULLIF(string1, ''), string2) AS String
.......
Subscribe to:
Posts (Atom)