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!

Import/ Export Excel sheets in SQL Server

Status
Not open for further replies.

itmasterw

Programmer
Apr 13, 2003
147
US
I am soon going to be working with SQL Server, and not Access. Currently I do not have away to try this. So I was woundering if anyone knows if this can be done with SQL Server.
Currently I use something like this to import an Excel sheet to an Access Database table:

StrSQL = "SELECT [Summary$].* INTO [Escrow_Avdvance_rtp1] FROM [Summary$] IN '" & FileName2 & "' [Excel 8.0; HDR = YES;];"
Cn.Execute StrSQL

Or something like this to get data from an Access data base to an Excel sheet .

SQLStr = ("SELECT * INTO [Excel 8.0;" & "Database=G:\APPO\MerlsS2.XLS].[Sheet1]" FROM tblFinalOut")
CN.Execute SQLStr

I was wondering if this would work if I was using a SQL Server database instead of an Access Database. If not what could I use? I know that I can use DTS but I Want to run it from the vb Program and I do not know how to run a DTS from a VB Program.

Thank you


ITM
 
You could look into the OPENROWSET function in Books Online
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top