Issue saving SQL query results in Excel

Issue saving SQL query results in Excel

My query results look like this in SQL Server. EmpBarr has string with multiple values that must be double quoted and comma delimited.

id      EmpBarr
6928108 "ELL","LII","LLL"

When I copy the results to the excel worksheet (text formatted cells) , I lose the quotes from the ELL in EmpBarr column converting it to ELL,"LII","LLL"

Is there any work around for this? Thanks!

答案1

I figured it. I do not need quotes around each concatenated value ; all I need is

id,EmpBarr
6928108,"ELL,LII,LLL"

Modified the script to handle it.

相关内容