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

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Import excel to Database

Author  Topic 

voyager838
Yak Posting Veteran

90 Posts

Posted - 2010-09-19 : 13:18:52
Hi

I try to search info on how to import an excel file to ms sql server
I want to do that specific from an commandline from a batchfile.

Can i use isql, osql or sqlcmd to complete this task ?

I don't know where to start.

Most Grateful
V

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-19 : 14:38:19
From the command line, you can easily do this via bcp.exe.

You can also use the sql query tools you mentioned (isql is 7.0 and earlier, osql is 2000, sqlcmd is 2005+) combined with OPENQUERY (search for the forums on this).

I prefer bcp.exe as it is super simple when importing csv files, which Excel can do.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

voyager838
Yak Posting Veteran

90 Posts

Posted - 2010-09-19 : 14:58:06
@tkizer:

Oh of course, how could i missed that.

Now it works.

Thanks! your really great! :-)

Sincerely
V
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-19 : 15:53:10
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -