|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Friday, February 04, 2011 7:20 AM
Points: 977,
Visits: 1,499
|
|
Great article!
Really good info from Jim Cheong too!
I know I'll be upgrading some old Excel work sooner rather than later, and the current lack of a 64 bit Jet driver has had me wondering what best to do.
Thanks!
Tom Garth Vertical Solutions
"There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, May 03, 2012 8:06 AM
Points: 3,
Visits: 16
|
|
| Cannot download your stored procedure - link is broken?
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, February 20, 2013 10:51 AM
Points: 531,
Visits: 416
|
|
The link in the article does not work anymore. Please use the links in the "Resources" in the end of the article.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, December 21, 2012 6:34 AM
Points: 20,
Visits: 129
|
|
I tried your code on a WinXP 64-bit workstation connected to SQL Server 2008 64-bit. I always get this error:
Cannot bulk load. The file "C:\TestBook.xml" does not exist. at line 1 Msg 50000, Level 16, State 1, Procedure uspImportExcelSheet, Line 497 Cannot bulk load. The file "C:\TestBook.xml" does not exist.
No matter where I put the "TestBook.xml" file ("C:" or a network drive), it cannot find the file. Am I missing something?
Denis W. Repke
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, February 17, 2010 11:38 AM
Points: 2,
Visits: 8
|
|
When running this script, I get:
SET @WorkSheet=NULL; SELECT @WorkSheet=CAST(BulkColumn as xml) FROM OPENROWSET (BULK 'M:\HTS\Export\currency.xls', SINGLE_BLOB ) A; XML parsing: line 0, character 0, unrecognized input signature at line 1 Msg 50000, Level 16, State 1, Procedure uspImportExcelSheet, Line 497 XML parsing: line 0, character 0, unrecognized input signature
Tried a few xls files, all gave the same error.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Thursday, March 07, 2013 11:07 AM
Points: 266,
Visits: 159
|
|
| This may be a little off-topic, but is there a way to convert dBase files to xml for import into SQL Server 2008 (64-bit) tables?
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, December 17, 2012 10:05 PM
Points: 4,
Visits: 11,712
|
|
Here is the Openrowset/Opendatasource Test Script you can use after the above installation.
/* Ref: http://www.connectionstrings.com/excel-2007 If you want to read the column headers into the result set (using HDR=NO even though there is a header) and the column data is numeric, use IMEX=1 to avoid crash.
To always use IMEX=1 is a safer way to retrieve data for mixed data columns. Consider the scenario that one Excel file might work fine cause that file's data causes the driver to guess one data type while another file, containing other data, causes the driver to guess another data type. This can cause your app to crash. */
SELECT * FROM OPENROWSET( 'Microsoft.ACE.OLEDB.12.0', 'Excel 12.0 XML;HDR=YES;IMEX=1Database=c:\install\AgeHeartRate.xls;', 'SELECT * FROM [Sheet1$]');
Select * from opendatasource( 'Microsoft.ACE.OLEDB.12.0', 'Excel 12.0 Xml;IMEX=1;Database=c:\install\AgeHeartRate.xls;')...[Sheet1$]
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, February 20, 2013 10:51 AM
Points: 531,
Visits: 416
|
|
Denis,
First, in Your scenario, the file needs to be in the C:\ drive of the SQL Server box;
Second, check the file security: If you log on SQL Server by a SQL Server login, the SQL Server service (process) account is used to access the file.
If you log on SQL Server by Windows Authentication, you can read only those files that can be accessed by your windows account, regardless of the security settings of the SQL Server service account.
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, February 20, 2013 10:51 AM
Points: 531,
Visits: 416
|
|
sckemp1,
Did you save your spreadsheet as xml in Excel?
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, May 03, 2012 8:06 AM
Points: 3,
Visits: 16
|
|
Gordon,
what program creates your dBase files?
Newer version of dBase, and their clones such as Visual Foxpro, have support for converting tables to XML files. Otherwise it is quite elementary, although not so fast, to skip through the table and adding XML tags around the values.
|
|
|
|