article, we will see how to use Comma Separated Values
(CSV) from table column and text file load in the table in the SQL Server2005.You
can specify row and column delimiters, making it easy to import files in
comma-separated values. A comma-separated values file contains the values in a
table as a series of ASCII text lines organized so that each column value is
separated by a comma from the next column's value and each row starts a new
SELECT F_Name FROM Student
SELECT SUBSTRING((SELECT ','+Student.F_Name
FOR XML PATH ('')),3,3000) AS CSV
file in drive C: with name Student.txt with following content. The location of
the file is C:\Student.txt
Image of Textfile:-
following script to load all the data from CSV to database table. I am trying
to load text files into a table in SQL Server 2005 management studio using bulk
insert. I am able to load the file into the table but the bulk insert process
isn't identifying correct row delimiter. My text file has different number of
columns for each row.
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
SELECT *FROM Student
After load the textfile in the table,Show the
article, you saw how to use Comma Separated Values (CSV) in the SQL Server2005.