Connecting Tech Pros Worldwide Forums | Help | Site Map

insert rows dynamically

Newbie
 
Join Date: Aug 2009
Posts: 16
#1: Sep 23 '09
Respected Sir,

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

insert into Question_Copy(,column_name1,column_name2,column_na me3)
SELECT top 1 column_name1,column_name2,column_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..

Reply