Friday 22 May 2020

While loop on table rows in sql server




DECLARE @CursorTestID INT = 1;
DECLARE @RowCnt BIGINT = 0;

-- get total count of rows to process
SELECT @RowCnt = COUNT(0) FROM tbl_User_Registration;

WHILE @CursorTestID <= @RowCnt
BEGIN
declare @StrBinary varchar(350)='abc12345'

   UPDATE tbl_User_Registration SET [Password] = @StrBinary WHERE [Password] is null;
   SET @CursorTestID = @CursorTestID + 1

END



No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...