Hey I have a name column in my table, suppose i get have name O’Neil, when ever i read this name and insert into a linked server throught dynamic SQL I get error…How to handle this…
One method is to check if my name has a quote(‘) but I am researching if someone coul
my dynamic SQL looks like
‘name = ‘+@quote+@name+@quote
@quote is nothing but below…
set @quote = ””
thanks,
Naga
I guess you problem could be demonstrated with this code:
Result:
Unclosed quotation mark after the character string 'Neil'.You can use quotename to properly add quote characters:
The better alternative is to use sp_executesql and pass
@Nameas a parameter.