Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
variables and table variables inside a cursor loop
declare @id int DECLARE i CURSOR FAST_FORWARD LOCAL FOR select Id from Pilots OPEN i FETCH NEXT FROM i INTO @id WHILE (@@fetch_status = 0) BEGIN --every time I do this I make this same mistake declare @table_variable table ( id int ) insert into @table_variable(ID) select @id --with new iteration table content is not erased (same with scalar variables) !!!! --delete from @table_variable --do this select count(*) from @table_variable FETCH NEXT FROM i INTO @id END CLOSE i DEALLOCATE i
run
|
edit
|
history
|
help
0
FETCH THE WEEKDAYS DATA
SQL HW 1 Appline
mc170400712
Negociosj
student table create
QLCB_BTVN_TUAN 8
Find users who have been watching kid's programmes for 13 weeks
Demo
Common Table Expression
base de datos dbfloreria