CREATE TABLE test2(clm1 INT,clm2 INT)
INSERT INTO test2 VALUES(1,1)
INSERT INTO test2 VALUES(2,2)
INSERT INTO test2 VALUES(3,3)
INSERT INTO test2 VALUES(4,4)
DECLARE @par1 INT = 100;
DECLARE @par2 INT = NULL;
UPDATE test2
SET clm1 = COALESCE(@par1,clm1)
,clm2 = COALESCE(@par2,clm2)
WHERE clm1 = 1
SELECT * FROM test2
DROP TABLE test2
2 comments:
You Are Awesome Mahesh.
You Are Awesome Mahesh.
Post a Comment