Hi,
I want to update a col , which is null initially. It can be done it two way.
I have to run UPDATE STMT at many places becuase it keeps error history for the row sprated by | and :
1)
CREATE TABLE #remarkT
(ID int NOT NULL PRIMARY KEY,
Remark varchar(max));
GO
INSERT INTO #remarkT
VALUES (1, '');
-- Output for controll
SELECT * FROM #remarkT;
UPDATE #remarkT
SET Remark .Write(' error2: message2 , procedure2 etc|', LEN(Remark), NULL)
WHERE ID = 1;
SELECT * FROM #remarkT;
DROP TABLE #remarkT;
2)
UPDATE #remarkT SET Remark = ISNULL(Remark,'') + 'error1: message , procedure etc|'
WHERE ID =1
SELECT * FROM #remarkT
--------------------------------
Q1) Please tel me which one is correct in my situation.
Q2) Please tel me is there any better way to accomplish it.
Q3) It gives error if i put null in first insert stmt, so i have to put '' in insert stmt.
Is there any other way so that i can keep NULL initially in my col for each row IN #remarkT
yours sinclerely