Wednesday, March 7, 2012

insert question

This is more of a sql query syntax question then anything but I need to run it on my handheld.

I have 3 data collection tables, and 3 staging tables that will be used to PUSH the data back to the SQL Server.

so here is what happens:

to populate staging table 1 I do

insert into stagingtable1 (id, col1, col2, col3) select newid, col1, col2, col3 from datacollection table1

staging table 2:

insert into stagingtable2 (id) select id from stagingtable1

staging table 3.

insert into stagingtable2 (id - (now this ID field needs to be the same id field as staging table 2 and staging table 1 have) col1, col2, col3, col4, from DataCollectionTable2

how can I create the insert SQL for my staging table 3?

revised:

there is no columns I can join on to get the uploadID to insert into stagingtable 3

No comments:

Post a Comment