I have an Excel spreadsheet that I want to import select columns into my SQL Server 2008 database table. The wizard didn't offer that option.
Do any easy code options exist?
Right-click the selected cells and select Copy. Switch back to SQL Server Management Studio and scroll down to the last row at the bottom and locate the row with a star in the left-most column. Right click the star in the column header and select Paste.
For on-premise solution: One time: could right click database instance and choose Task-> Import Data. Automatic: build SSIS package and schedule job in SQL server to run ETL process.
Once connected to Sql Server 2005 Database, From Object Explorer Window, right click on the database which you want to import table into. Select Tasks -> Import Data. This is a simple tool and allows you to 'map' the incoming data into appropriate table. You can save the scripts to run again when needed.
Microsoft suggest several methods:
If the wizard (DTS) isn't working (and I think it should) you could try something like this http://www.devasp.net/net/articles/display/771.html which basically suggests doing something like
INSERT INTO [tblTemp] ([Column1], [Column2], [Column3], [Column4]) SELECT A.[Column1], A.[Column2], A.[Column3], A.[Column4] FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\Excel.xls;HDR=YES', 'select * from [Sheet1$]') AS A;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With