August 20, 2010 at 7:07 am
Hi,
I'm trying to import from an excel spreadsheet but am getting an error when i try and import from a worksheet that has a space in it e.g. "sheet a". I've tried single quotes, double quotes around it to no avail:
insert INTO tableA select * FROM OPENROWSET
('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Test.xls', [sheet a$])
Is it possible to do this? alternatively is it possible for OPENROWSET to use a parameter to select a particular sheet each time ie the 3rd worksheet in a spreadsheet?
August 20, 2010 at 7:13 am
This link has some useful tips for how to accomplish this.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
August 23, 2010 at 4:01 am
yes i'd already gone down that route before asking to no avail. hence the question.
August 23, 2010 at 3:41 pm
This link (one of the ones returned from the first one above) shows how to do this.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
August 26, 2010 at 3:42 am
Yes that did the trick, thank you.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy