有沒有什麼方法可以用1從1開始的升序序列填充空列,而不使用標識?用序列填充空列
我嘗試以下光標但它對於在列中的所有行填充相同的值(450):
declare cur3 cursor for
select new_id from sheet1$
declare @no int
declare @no1 int
set @no1 = 1
open cur3
fetch next from cur3 into @no
while(@@FETCH_STATUS = 0)
begin
update sheet1$ set new_id = @no1
set @no1 = @no1 + 1
fetch next from cur3 into @no
end
close cur3
deallocate cur3
你想使用哪種語言? MySQL的?標準SQL?微軟SQL? TSQL? – Jocelyn
@Jocelyn:即時通訊使用sql server ... so tsql ...謝謝 –