eselhassan
Programmer
Hi all,
From SQL Server I linked to an iSeries AS400 and everything works just fine. I can query the AS400 file/table with the following count statement:
select * from openquery(MYLINKEDSERVER, 'select count(*) from myFile/myLib')
I would like to use an IF statement first to check whether the AS400 file/table has data or not. If it has then the following statements follow:
Delete from mySQLtable
GO
Insert into mySQLtable(R1, R2, R3)
Select * from openquery(MYLINKEDSERVER, 'select W1, W2, W3 from myFile/myLib')
GO
And if the AS400 file/table is empty then nothing get executed and a message stating that would be nice. Any help is greatly appreciated.
From SQL Server I linked to an iSeries AS400 and everything works just fine. I can query the AS400 file/table with the following count statement:
select * from openquery(MYLINKEDSERVER, 'select count(*) from myFile/myLib')
I would like to use an IF statement first to check whether the AS400 file/table has data or not. If it has then the following statements follow:
Delete from mySQLtable
GO
Insert into mySQLtable(R1, R2, R3)
Select * from openquery(MYLINKEDSERVER, 'select W1, W2, W3 from myFile/myLib')
GO
And if the AS400 file/table is empty then nothing get executed and a message stating that would be nice. Any help is greatly appreciated.