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
20181CSE0534
SQL HW 1 Appline
MLK Date
Preppin Data Challenge - Week 8
SQL Server - NULL values with IN and NOT IN (Solution)
check constraint
Chaudhary
adbms 0
join ans
dynamic pivot