How to import CSV file in SQL server 2008?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}
up vote
5
down vote
favorite
I am trying to import a CSV file in SQL Server 2008. BULK INSERT
is a way to go but it is applicable for CSV from SQL Server 2014 onwards.
What would be an alternative way to achieve this goal?
Any thoughts/ideas much appreciated.
sql-server sql-server-2008 import csv
New contributor
add a comment |
up vote
5
down vote
favorite
I am trying to import a CSV file in SQL Server 2008. BULK INSERT
is a way to go but it is applicable for CSV from SQL Server 2014 onwards.
What would be an alternative way to achieve this goal?
Any thoughts/ideas much appreciated.
sql-server sql-server-2008 import csv
New contributor
1
ActuallyFORMAT='CSV'
is 2017+ (14 is the major version number).
– Aaron Bertrand♦
Nov 5 at 16:00
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I am trying to import a CSV file in SQL Server 2008. BULK INSERT
is a way to go but it is applicable for CSV from SQL Server 2014 onwards.
What would be an alternative way to achieve this goal?
Any thoughts/ideas much appreciated.
sql-server sql-server-2008 import csv
New contributor
I am trying to import a CSV file in SQL Server 2008. BULK INSERT
is a way to go but it is applicable for CSV from SQL Server 2014 onwards.
What would be an alternative way to achieve this goal?
Any thoughts/ideas much appreciated.
sql-server sql-server-2008 import csv
sql-server sql-server-2008 import csv
New contributor
New contributor
edited Nov 5 at 15:39
LowlyDBA
6,66352241
6,66352241
New contributor
asked Nov 5 at 15:20
T.H.
755
755
New contributor
New contributor
1
ActuallyFORMAT='CSV'
is 2017+ (14 is the major version number).
– Aaron Bertrand♦
Nov 5 at 16:00
add a comment |
1
ActuallyFORMAT='CSV'
is 2017+ (14 is the major version number).
– Aaron Bertrand♦
Nov 5 at 16:00
1
1
Actually
FORMAT='CSV'
is 2017+ (14 is the major version number).– Aaron Bertrand♦
Nov 5 at 16:00
Actually
FORMAT='CSV'
is 2017+ (14 is the major version number).– Aaron Bertrand♦
Nov 5 at 16:00
add a comment |
2 Answers
2
active
oldest
votes
up vote
9
down vote
accepted
SQL Server has always supported bulk inserting from CSV files, you just have to specify field/row terminators.
file.csv contains:
foo,bar,1
blat,splunge,2
Then we do this:
CREATE TABLE #foo(a varchar(32), b varchar(32), c int);
BULK INSERT #foo FROM 'c:tempfile.csv'
WITH (ROWTERMINATOR = 'n', FIELDTERMINATOR = ',');
SELECT * FROM #foo;
Results:
a b c
-------- -------- ----
foo bar 1
blat splunge 2
add a comment |
up vote
2
down vote
Following link
https://support.discountasp.net/kb/a1179/how-to-import-a-csv-file-into-a-database-using-sql-server-management-studio.aspx
If you problem then next link follow
I hope solve your problem
https://host4asp.net/import-csv-file-using-sql-server-management-studio/
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
9
down vote
accepted
SQL Server has always supported bulk inserting from CSV files, you just have to specify field/row terminators.
file.csv contains:
foo,bar,1
blat,splunge,2
Then we do this:
CREATE TABLE #foo(a varchar(32), b varchar(32), c int);
BULK INSERT #foo FROM 'c:tempfile.csv'
WITH (ROWTERMINATOR = 'n', FIELDTERMINATOR = ',');
SELECT * FROM #foo;
Results:
a b c
-------- -------- ----
foo bar 1
blat splunge 2
add a comment |
up vote
9
down vote
accepted
SQL Server has always supported bulk inserting from CSV files, you just have to specify field/row terminators.
file.csv contains:
foo,bar,1
blat,splunge,2
Then we do this:
CREATE TABLE #foo(a varchar(32), b varchar(32), c int);
BULK INSERT #foo FROM 'c:tempfile.csv'
WITH (ROWTERMINATOR = 'n', FIELDTERMINATOR = ',');
SELECT * FROM #foo;
Results:
a b c
-------- -------- ----
foo bar 1
blat splunge 2
add a comment |
up vote
9
down vote
accepted
up vote
9
down vote
accepted
SQL Server has always supported bulk inserting from CSV files, you just have to specify field/row terminators.
file.csv contains:
foo,bar,1
blat,splunge,2
Then we do this:
CREATE TABLE #foo(a varchar(32), b varchar(32), c int);
BULK INSERT #foo FROM 'c:tempfile.csv'
WITH (ROWTERMINATOR = 'n', FIELDTERMINATOR = ',');
SELECT * FROM #foo;
Results:
a b c
-------- -------- ----
foo bar 1
blat splunge 2
SQL Server has always supported bulk inserting from CSV files, you just have to specify field/row terminators.
file.csv contains:
foo,bar,1
blat,splunge,2
Then we do this:
CREATE TABLE #foo(a varchar(32), b varchar(32), c int);
BULK INSERT #foo FROM 'c:tempfile.csv'
WITH (ROWTERMINATOR = 'n', FIELDTERMINATOR = ',');
SELECT * FROM #foo;
Results:
a b c
-------- -------- ----
foo bar 1
blat splunge 2
answered Nov 5 at 15:58
Aaron Bertrand♦
148k18279476
148k18279476
add a comment |
add a comment |
up vote
2
down vote
Following link
https://support.discountasp.net/kb/a1179/how-to-import-a-csv-file-into-a-database-using-sql-server-management-studio.aspx
If you problem then next link follow
I hope solve your problem
https://host4asp.net/import-csv-file-using-sql-server-management-studio/
add a comment |
up vote
2
down vote
Following link
https://support.discountasp.net/kb/a1179/how-to-import-a-csv-file-into-a-database-using-sql-server-management-studio.aspx
If you problem then next link follow
I hope solve your problem
https://host4asp.net/import-csv-file-using-sql-server-management-studio/
add a comment |
up vote
2
down vote
up vote
2
down vote
Following link
https://support.discountasp.net/kb/a1179/how-to-import-a-csv-file-into-a-database-using-sql-server-management-studio.aspx
If you problem then next link follow
I hope solve your problem
https://host4asp.net/import-csv-file-using-sql-server-management-studio/
Following link
https://support.discountasp.net/kb/a1179/how-to-import-a-csv-file-into-a-database-using-sql-server-management-studio.aspx
If you problem then next link follow
I hope solve your problem
https://host4asp.net/import-csv-file-using-sql-server-management-studio/
answered Nov 5 at 17:38
Mahfuz Morshed
1191210
1191210
add a comment |
add a comment |
T.H. is a new contributor. Be nice, and check out our Code of Conduct.
T.H. is a new contributor. Be nice, and check out our Code of Conduct.
T.H. is a new contributor. Be nice, and check out our Code of Conduct.
T.H. is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f221817%2fhow-to-import-csv-file-in-sql-server-2008%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Actually
FORMAT='CSV'
is 2017+ (14 is the major version number).– Aaron Bertrand♦
Nov 5 at 16:00