filed in Programming, SQL on Jan.11, 2012
Method 1: Using a cursor declare cursor1 cursor local for select * from tablename open cursor1 fetch next from cursor1 into #temptable while @@fetch_status = 0 begin if exists (select column from tablename where id = (select id from #temptable)) begin /* do stuff here */ end else begin /* do other stuff here */ [...]
Tags: cursor, database, dbms, iterate, Programming, result set, SQL, table, temp, temporary
filed in Programming, SQL on Jan.11, 2012
Method 1: Using a cursor declare cursor1 cursor local for select * from tablename open cursor1 fetch next from cursor1 into #temptable while @@fetch_status = 0 begin if exists (select column from tablename where id = (select id from #temptable)) begin /* do stuff here */ end else begin /* do other stuff here */ [...]
Tags: cursor, cursors, database, dbms, iterate, Programming, result set, rows, SQL, table, temp, temporary