Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting data from Excel sheet

Status
Not open for further replies.

sparkme

Programmer
Oct 3, 2003
30
US
I have a Excel file Called Customerdata with data in one sheet called data value(There is another sheet in the same Excel file, This Excel sheet is in my Local drive C:

Can anyone tell me the syntax to fetch the record from this excel file the following code is not working(FYI)
SELECT * FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;DATABASE= C:\Customerdata.xls;User ID=sa;Password=',
'SELECT * FROM [data value$]')

Thanks
 
Try this:

SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="C:\Customerdata.xls";User ID=;Password=;Extended properties=Excel 8.0')...[data value$]


Zhavic

---------------------------------------------------------------
In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
 
Thanks for all the replies to this thread now I got the answer....


SELECT * FROM OPENROWSET
(''Microsoft.Jet.OLEDB.4.0'',
''Excel 8.0;DATABASE= C:\Customerdata.xls;User ID=Admin;Password='', ''SELECT * FROM [data value$]'' )


Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top