I have been reading over the answers to the question posed here:
How to get export output in "real" CSV format in SQL Server Managment Studio?
I find the post by Joel Coohoern
most useful, but have a follow-up question. My rep is not sufficient to post a comment, so I pose a question (hopefully that does not annoy too much).
But why would one want to use the replace function to add in double quotes to already in place single quote? The suggested formula below:
SELECT '"' + REPLACE(CAST(column AS NVARCHAR(4000)), '"', '""') + '"' AS Header, ... FROM ...
For instance if there was an entry in a field that was John "J
, then the formula above would make it "John ""J"
. Why would one want it that way as opposed to "John "J"
. I am just trying to grasp the utilization of the replace function in the previous post.
Thanks.