insert rows dynamically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shashi shekhar singh
    New Member
    • Aug 2009
    • 30

    insert rows dynamically

    Respected Sir,

    i want to check it out, when insert returns zero rows affected ?

    insert into Question_Copy(, column_name1,co lumn_name2,colu mn_name3)
    SELECT top 1 column_name1,co lumn_name2,colu mn_name3
    FROM tablename where column_name1 not in (select column_name1 from Question_Copy)
    --and column_name2 not in (select column_name2 from Question_Copy)
    and UNIT_CODE not in (select UNIT_CODE from Question_Copy)
    --and column_name3 not in (select column_name3 from Question_Copy)
    order by newid() ;
    // here i want to check if it returns zero rows affected then execute other query.
    please make a reply, i am waiting for your reply..
Working...