Below is my SQL update that i was trying and didnt work. But it worked for a single record integer update while using @sampids as INT data type. Any help would be much appreciated. Thanks
DECLARE @sampids AS NVARCHAR(1000)='10,20,30'
DECLARE @sampcursorno AS INT=0
DECLARE sample_cursor CURSOR FOR
SELECT VALUE FROM Split(@sampids,',')
OPEN sample_cursor
FETCH NEXT FROM sample_cursor INTO @sampcursorno
WHILE @@FETCH_STATUS = 0
BEGIN
UPDATE tbl_Testing
SET SampId = @sampcursorno
FETCH NEXT FROM sample_cursor INTO @sampcursorno
END
CLOSE sample_cursor
DEALLOCATE sample_cursor
whereclause. So each iteration of the cursor ALL rows are updated. When the cursor is finished all rows will be updated with whatever value came last (you also have no control over that, btw.).