I have four fields in a table (this table gets reimported when a new item has to be added to tables). Only one field gets populated with data to be added to tables at a time but there are four fields and any one of them can be populated each time e.g.
1st import
field1 = null
field2 = data
field3 = null
field4 = null
second import
field1=data
field2=null
field3=null
field4=null
Depending on which field is populated, I must add this data to tables but on different servers.
For example, if field1 has data then must populate tables on Server1/database1 with this data, if field2 has data then must populate data on Server2/database2 tables.
I have a case statement to look for data:
case when Len(field1)>0 then 'C'
when Len(field1)>0 then 'D'
-- would then like insert if 'C' then insert into server1.database1.table etc. Also, I have to insert data into more than one table and so have multiple insert statements.
Is this possible to do in a case statement?
thanks,
Barz