How to import CSV file in SQL server 2008?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
2
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
2
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â¦
58 mins ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
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 1 hour ago
LowlyDBA
6,62452241
6,62452241
New contributor
asked 1 hour ago
T.H.
333
333
New contributor
New contributor
1
ActuallyFORMAT='CSV'
is 2017+ (14 is the major version number).
â Aaron Bertrandâ¦
58 mins ago
add a comment |Â
1
ActuallyFORMAT='CSV'
is 2017+ (14 is the major version number).
â Aaron Bertrandâ¦
58 mins ago
1
1
Actually
FORMAT='CSV'
is 2017+ (14 is the major version number).â Aaron Bertrandâ¦
58 mins ago
Actually
FORMAT='CSV'
is 2017+ (14 is the major version number).â Aaron Bertrandâ¦
58 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
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 |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
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
4
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
4
down vote
accepted
up vote
4
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 1 hour ago
Aaron Bertrandâ¦
147k18279475
147k18279475
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â¦
58 mins ago