How do you import a CSV file into MS SQL?
-
Excuse my lack of knowlege here, I am primarily a MySql user. Importing data in MySQL is a piece of cake in through mysql.exe using the following syntax:
LOAD DATA LOCAL INFILE 'filename.csv' INTO TABLE myTable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
But I now have to switch over to SQL Server. Is there an equivalent SQL Conversational interface like mysql.exe through which I can enter SQL commands? If not, what is the recommended method for importing files? Mike Luster CTI/IVR/Telephony SME -
Excuse my lack of knowlege here, I am primarily a MySql user. Importing data in MySQL is a piece of cake in through mysql.exe using the following syntax:
LOAD DATA LOCAL INFILE 'filename.csv' INTO TABLE myTable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
But I now have to switch over to SQL Server. Is there an equivalent SQL Conversational interface like mysql.exe through which I can enter SQL commands? If not, what is the recommended method for importing files? Mike Luster CTI/IVR/Telephony SMEThere are several interfaces to enter SQL commands for SQL Server: Query Analyzer (a GUI application),
isql.exe
andosql.exe
, plussqlcmd.exe
in SQL Server 2005. For performing a bulk file import, you would normally use eitherbcp.exe
(stands for Bulk CoPy) or theBULK INSERT
statement. Stability. What an interesting concept. -- Chris Maunder -
Excuse my lack of knowlege here, I am primarily a MySql user. Importing data in MySQL is a piece of cake in through mysql.exe using the following syntax:
LOAD DATA LOCAL INFILE 'filename.csv' INTO TABLE myTable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
But I now have to switch over to SQL Server. Is there an equivalent SQL Conversational interface like mysql.exe through which I can enter SQL commands? If not, what is the recommended method for importing files? Mike Luster CTI/IVR/Telephony SMEYou need the MS SQL server enterprise manager there you will find a tool just to import and export data for just about anything. Hear,See,Learn,Understand,Practice Many can be good,but only ONE can be the best keep practicing
-
You need the MS SQL server enterprise manager there you will find a tool just to import and export data for just about anything. Hear,See,Learn,Understand,Practice Many can be good,but only ONE can be the best keep practicing
Thanks guys, I used Enterprise Manager and it was pretty simple for importing 37K rows of CSV data. Getting data into your database is easy BUT... when I create a Table Definition importing to that seems to need some extra work. I get the impression I'll have to write a Stored Procedure in TSQL to convert the data into the desired custom Table Format. Recommendations welcome. Mike Luster CTI/IVR/Telephony SME