Author |
Topic |
santana
Yak Posting Veteran
72 Posts |
Posted - 2009-11-24 : 05:59:47
|
Hi,I am using the Microsoft SQL Server Management Studio Express and I need to import the data from Excel file to table (SQL Server 2005).I don't know how I am doing this, I don't have any other tool.Could you help me, please?Regards, |
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-11-24 : 08:41:04
|
HiSQL Server linked serversExampleSELECT * INTO XLImport1 FROM EXCELLINK...[Customers$]SELECT * INTO XLImport2 FROM OPENQUERY(EXCELLINK, 'SELECT * FROM [Customers$]') SQL Server distributed queriesExampleSELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=C:\test\xltest.xls;Extended Properties=Excel 8.0')...[Customers$]SELECT * INTO XLImport4 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\test\xltest.xls', [Customers$])SELECT * INTO XLImport5 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\test\xltest.xls', 'SELECT * FROM [Customers$]') -------------------------R... |
|
|
santana
Yak Posting Veteran
72 Posts |
Posted - 2009-11-24 : 10:03:06
|
Hi,I tried those, but I received error:- SELECT * INTO [finance].[dbo].[fin_history] FROM 'C:\Historical.xlsx'['2007-2009 Total']error: Incorrect syntax near 'C:\Historical.xlsx'.-SELECT * INTO [finance].[dbo].[fin_history] FROM OPENQUERY('C:\Historical.xlsx', 'SELECT * FROM [2007-2009 Total$]')error: Incorrect syntax near 'C:\Historical.xlsx'.What is [Customers$] in your example?My excel file is in the same server to the sql server. But I didnt have Excel tool in the same server, only in another one.Could you help me again, please?path/file - C:\Historical.xlsxonly one sheet - ['2007-2009 Total']table - [finance].[dbo].[fin_history]Thank you!Regards, |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-11-24 : 12:19:52
|
quote: Originally posted by santana Hi,I tried those, but I received error:- SELECT * INTO [finance].[dbo].[fin_history] FROM 'C:\Historical.xlsx'['2007-2009 Total']error: Incorrect syntax near 'C:\Historical.xlsx'.-SELECT * INTO [finance].[dbo].[fin_history] FROM OPENQUERY('C:\Historical.xlsx', 'SELECT * FROM [2007-2009 Total$]')error: Incorrect syntax near 'C:\Historical.xlsx'.What is [Customers$] in your example?My excel file is in the same server to the sql server. But I didnt have Excel tool in the same server, only in another one.Could you help me again, please?path/file - C:\Historical.xlsxonly one sheet - ['2007-2009 Total']table - [finance].[dbo].[fin_history]Thank you!Regards,
[Customers$] shee name.i think its .xls file-------------------------R... |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
santana
Yak Posting Veteran
72 Posts |
Posted - 2009-11-25 : 05:06:47
|
Hi,thanks for all replays.I received that msg/error: Msg 7399, Level 16, State 1, Line 1The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.Msg 7303, Level 16, State 1, Line 1Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".I don't know how can I fix this!Regards, |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-11-25 : 07:30:07
|
Read all the replies posted in the link I have givenMadhivananFailing to plan is Planning to fail |
|
|
behrman
Yak Posting Veteran
76 Posts |
Posted - 2009-11-28 : 07:21:52
|
Hi.SQL Server 2005 Management Studio provides the ability to copy and paste columns directly from Excel to SQL Server when the table and column names match up. Let's walk through a simple example. Assume you have a database called 'Test' with a table called 'MyTable' consisting of two columns (MyID, MyDesc). In addition, you have an Excel worksheet where you want to load data directly from Excel to SQL Server. Let's walk through setting up and testing that scenario.For detailed operations, please refer to http://www.mssqltips.com/tip.asp?tip=1430.Regards,behrman.RAQ Report: Web-based Excel-like Java reporting tool |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-11-28 : 07:26:13
|
quote: Originally posted by behrman Hi.SQL Server 2005 Management Studio provides the ability to copy and paste columns directly from Excel to SQL Server when the table and column names match up. Let's walk through a simple example. Assume you have a database called 'Test' with a table called 'MyTable' consisting of two columns (MyID, MyDesc). In addition, you have an Excel worksheet where you want to load data directly from Excel to SQL Server. Let's walk through setting up and testing that scenario.For detailed operations, please refer to http://www.mssqltips.com/tip.asp?tip=1430.Regards,behrman.RAQ Report: Web-based Excel-like Java reporting tool
I think OP may want it to automateMadhivananFailing to plan is Planning to fail |
|
|
|