September 15, 2006 at 7:50 pm
I am having an issue excepting quotes from a java app in a text string. We are using a stored procedure and several variables are text strings. In the stored procedure I also kick off another sproc on a linked server. I can get the local db to stored the data correctly using the REPLACE function, however, that's not working on the linked server. The string data is sent into the variable as so... 'It''s fun working with quotes'
Any help would be great.
Thanks, Melissa
September 15, 2006 at 8:04 pm
I'm always in favor of making the client communicate correctly with the server. So the application passing the information should be responsible for passing it correctly.
However, if you want to handle it, why not make a function on your end that cleans strings of superfluous quotes, and always call this first before passing anything on? (You say you kick off the stored proc on the related server, so it sounds like you have the opportunity to fix it before.)
(Note that the problem with cleaning it on your end is that you don't always know that there isn't supposed to be two single quotes together in a particular string.)
September 16, 2006 at 6:22 am
September 17, 2006 at 10:44 am
I think it is better to handle them as what they are in Java or C# they are string literals with double-qoutes (") and in ANSI SQL they are Qouted Identifiers and Delimiters per ANSI SQL 1992. The key is there are fixed rules of how to handle them. Try the link below for SQL Server Delimiters, sorry I don't write Java anymore but you could check the docs of how to handle them. In C# ("") is required to use them. Hope this helps.
http://msdn2.microsoft.com/en-us/library/ms176027.aspx
Kind regards,
Gift Peddie
September 18, 2006 at 11:26 am
My developer says he doesn't have any options for how he submits the variables into the stored procedure. I am checking into the settings for the quoted identifier setting or collation. Where do I look for the seeting of the quoted identifier?
Thanks,
Melissa
September 19, 2006 at 10:51 am
The quoted identifier on both servers is unchecked.... however, the collation is different. Both are Latin1 but different. Does that make a big difference?
Melissa
September 19, 2006 at 11:33 am
You need to turn quoted_identifier on per the instructions in the link I posted and give this link to your developer most people don't know about literals, almost like idoms in English you don't need to know them. But they come with fixed rules of what you can do or your application will have to run without. Hope this help.
http://mindprod.com/jgloss/literals.html
Kind regards,
Gift Peddie
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply