I am exporting data from SQL server to an SQL file. The problem is some of the column entries that are strings contain commas so when I try to parse the SQL file (basically using string split with comma delim) I am not getting what I want. Anyone have a solution to this problem or a better idea?
Basically I need to separate the values in the query:
Example:
… VALUES (123, ‘bob likes to eat berries, and beans’)
If I split that using a comma as a delimiter I get:
123
'bob likes to eat berries
and beans'
Sounds like you need to export using a different delimiter. What are you using to export? If it’s the BCP command line utility, you could switch delimiters using the -t switch. For example,
-t |for pipe-delimited.