sql - How Can I Skip a row(an iteration) in MSSQL Cursor based on some condition? -


how can skip row(an iteration) in mssql cursor based on condition, have dts migrates thousands of records , based on criteria, records need not migrated duplicates , want skip these records.

any idea how can accomplish in mssql cursor?

thanks

sirak

i'm making few assumptions here use following guide:

    -- create test data             select '                                  ' [word] #mytempdataset;     insert #mytempdataset select 'this';     insert #mytempdataset select 'is';     insert #mytempdataset select 'a';     insert #mytempdataset select 'basic';     insert #mytempdataset select 'basic';     insert #mytempdataset select 'test';      declare @counter int     declare @word varchar(50)     declare mycursor cursor         select  *                #mytempdataset;         open mycursor         fetch next mycursor @word         while @@fetch_status = 0         begin                            -- check condition             select  @counter = count(*)                 #mytempdataset               word = @word              if @counter =1             begin                 -- process unique records                 print @word                  end                   fetch next mycursor @word         end         close mycursor;         deallocate mycursor;      drop table #mytempdataset; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -