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 with valid comma

Author  Topic 

ngontran
Starting Member

1 Post

Posted - 2010-11-14 : 23:06:57
Hi guys,

I'm a newbie here. Nice to meet everyone

Recently, I was trying to import a CSV file to a database as a table.
But I found out that in my CSV, it has something like this line:

DASD870W,"5.1CH DVD SYSTEM,",,SAM1000,AIWA LTD,AIWA,1025,DVD Lifestyle System,Browns

Note the bold field, somehow my the SQL server(2005) does not understand that as a single column but putting that string to the next column. Does anyone knows how to fix this type of problem? I believe this is a common case one but I couldn't find a helpful source for this.

Thnx in advance,



Kristen
Test

22859 Posts

Posted - 2010-11-15 : 11:48:13
Depends what you are importing the CSV file with. CSV specification means different things to different people!

To me it means:

Col1,Col2,Col3
Col1,"Col2 embedded,comma quote delimited",Col3
Col1,"Col2 embedded "" quote and quote delimited",Col3

and to some people it may mean allowing comma-delimiters for trailing, blank, columns to be ommitted

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-11-18 : 07:22:09
Did you try using a format file?
http://www.nigelrivett.net/SQLTsql/BCP_quoted_CSV_Format_file.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -