Commas within text to export to csv

  • Here's my situation. For some insane reason, my power user for an application set up his students with usernames comprised of last name comma first name. Now, I'm trying to export these usernames from SQL into a CSV file to be uploaded to a new product which uses an Oracle backend. Naturally, when I run the csv file, it considers the comma separating the last and first names as a field delimiter. When I try to import into the new product, it says I have too many fields. I can code to remove the comma, but I know my power user is going to insist upon keeping it. Is there any way to make this work? Thanks in advance for any help!

  • If your StudentName is not longer than NVARCHAR(128) then use

    QUOTENAME(StudentName, '"')

    This wraps values with double quotes so it will be read correctly by anything you would use to read it.

    _____________
    Code for TallyGenerator

  • Thanks, Sergiy!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply