0

I am trying to import something into SQL. The error is that the last field, SUB, in this case is too large and would be truncated. It makes sense that it would do so. The sample data below will bear this out. The CODDESC (code description) field has to have commas. The source file is a csv (comma delimited) file. When I import it into SQL, it understandably puts everything from the first comma in CODDESC into SUB. It has 14K rows and so manually editing it in Notepad ++ is impractical. As is importing into Excel.

 state     code    period    codty     coddesc        sub
   32      12345     20        1     clerk,cashier     1
   32      13456     20        1     cleaner,janitor   1

I looked at others such as Import CSV file into SQL Server

However, it is not clear how I would insert this FIELDTERMINATOR || into the text file/sql table. Is there a way to delimit in such a way to where you only do based on the first 5 commas. Fixed width does not work because the codedesc field is between 8 and 45 characters long.

Calflamesfann
  • 133
  • 4
  • 16

1 Answers1

0

Not really an answer but I was able to accomplish the task using find and replace in notepad ++ and then performing some manual edits so that I could import it into Excel.

Calflamesfann
  • 133
  • 4
  • 16