Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 bulk insert
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 11/15/2012 :  08:37:50  Show Profile  Reply with Quote
Please help me with a sql code to bulk insert data from excel in a table, without creating a table with predefined column names.

Thanks in advance.

Edited by - rapunzel on 11/15/2012 08:39:54

Flowing Fount of Yak Knowledge

5155 Posts

Posted - 11/15/2012 :  09:23:09  Show Profile  Reply with Quote
You can't use BULK INSERT, but you can use OPENROWSET. See this page for documentation and examples:

Adapting from one of the examples on that page, your code would be something like this

SELECT a.* INTO #tmp
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
   'c:\MSOffice\Access\Samples\northwind.mdb';'admin';'mypwd', Orders) as a
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 11/15/2012 :  10:15:25  Show Profile  Reply with Quote
if its excel it should be

FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=your full excel sheet path here', [SheetName$])

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000