August 8, 2005 at 2:58 pm
I have an stored procedure that creates a linked server connection to an excel file and inserts query results into the file. The issue is that the values have a single quote (') before them. I have come across this before and all I did was have the excel file's macro remove the single quote, but that is time consuming. Is there a way to keep sql from inserting the single quote before each value?
Thanks, Adam
August 8, 2005 at 3:04 pm
SQL will not insert a single quate infront of a value.
When we have Excel cell format a general and the value is numeric (Varchar field) excel will take that as as number. If the value is 00123. Excel will take it as 123. To avoid this programmers will add a ' in fron of the value. So check your stored procedure.
OR
If the data contains a leading ' then use replace function in the Select.
Regards,
gova
August 8, 2005 at 3:58 pm
Actually, I found the solution to the problem. SQL/Excel doesn't insert single quotes before the values, unless there is a blank value. For example, below is a list of what my results were (row values separated by commas).
City1,City1,City2,,'City1,'City2
I expect Excel is what is causing this to occur. I replaced the blank values inside my SQL tables and now it works fine.
Thanks,Adam
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply