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
 General SQL Server Forums
 New to SQL Server Programming
 import .csv to sql server from command line

Author  Topic 

ArturMT
Starting Member

1 Post

Posted - 2015-03-26 : 10:27:19
Hello i want to import a huge .csv file in my sql server database.
There are about 10000 rows and 30 columns
My file looks like this:
Attributname1; Attributname2; Attributname3; ...
data; data; data;...
data; data; data;...
data; data; data;...

Now my idea is to do this on the command line/batch script
I have found different ways to do this job but the problem is i have to create a table in the database first. The entries in the first line of the csv file are the attribute names.
After creating the table with attributes i must write the data in the database.
So i think this should be easy with the right commands. Unfortunally i dont know them.




gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-03-26 : 10:34:23
easy-peazy using SQL Server Import and Export wizard. Just save the resulting package somewhere. You can then run it using the DTEXEC command
Go to Top of Page
   

- Advertisement -