SQL Server - Need help in Query - Asked By shah zeb on 16-Dec-11 05:35 AM

Hi,
I need help in Query where a double check need to be done. and i need load to all the record where two columns not in in the opposite the next table.
hope problem is clear

Regards,
Manish Mishra replied to shah zeb on 16-Dec-11 06:22 AM
hi,
explain your problem with example or upload your example in a .zip format.
Chintan Vaghela replied to shah zeb on 17-Dec-11 02:33 AM

Hello,

Check your query as following way

 

 

IF NOT EXISTS(Select * from TableName2 where Field1 = 'Field1' && Field2 = 'Field2')

BEGIN

 

Insert Into TableName2(Field1,Field2) Select Field1,Field2 from TableName1 where Field1 = 'Field1' && Field2 = 'Field2'

END

Hope this is helpful !

Thanks