Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
2revup
Posting Yak Master
112 Posts |
Posted - 2014-05-19 : 23:43:26
|
Guys I am trying to import some data into my table - thats easy, but I have a few more coloums that are appended to the end, and not in the XLS. I cant just go an add them on to the XLS as this is an automated task that I need to make happen on a weekly basis. So I tried within the import itself and looking at the select it actually puts them at the front of the query so for example It will bring back Contact, comments, * (rest of the rows), if I could swap this order around I am sure this would work. Is there anyway I can do this?insert into BusinessSignups select * from openrowset ( 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Oracle\Business-Support-Signups\result1.xls', 'SELECT *, 0 as contact,null as comments FROM [result$]' )twhere not exists (select 1 from BusinessSignups where BusinessSignups.week = t.week and BusinessSignups.year = t.year and BusinessSignups.account_id = t.account_id ) go |
|
2revup
Posting Yak Master
112 Posts |
Posted - 2014-05-20 : 00:13:45
|
fixed: Move the added columns to the select * from openrowset line |
|
|
|
|
|