declare @Script_Code nvarchar(400),@Script_Name nvarchar(400),@rownum nvarchar(400)
declare @Script_Code1 nvarchar(400),@Script_Name1 nvarchar(400)
declare @Counter int
set @Counter=0
DECLARE db_cursor CURSOR FOR
select shareName,ShareCode,rownum
from (
select distinct row_number() over (order by ShareCode asc) as rownum, shareName,ShareCode from Table_3 )Temp
order by rownum asc
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @Script_Code,@Script_Name,@ rownum
WHILE @@FETCH_STATUS = 0
BEGIN
print @Counter
update Test1 set Script_Name=UPPER(@Script_ Name) where Script_Code=@Script_Code
print @Script_Code
set @Counter=@Counter+1
print @Counter
FETCH NEXT FROM db_cursor INTO @Script_Code,@Script_Name,@ rownum
END
CLOSE db_cursor
DEALLOCATE db_cursor
No comments:
Post a Comment