Sproc parameter: escaping ' character
From: Marina (someone_at_nospam.com)
Date: 04/14/04
- Next message: Vishal Parkar: "Re: Using OSQL"
- Previous message: Louis: "Re: Views inside Stored procedure"
- Next in thread: Adam Machanic: "Re: Sproc parameter: escaping ' character"
- Reply: Adam Machanic: "Re: Sproc parameter: escaping ' character"
- Reply: Marina: "Re: Sproc parameter: escaping ' character"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 14 Apr 2004 09:56:43 -0400
Hi,
Let's say I'm trying to execute a stored procedure by calling 'Exec'. If an
argument to the sproc has a single quote (which is doubled up), then the
whole thing dies with a syntax error. Consider this:
Exec MySproc 'arg1','here''s arg2','arg3'
For what it's worth, the syntax highlighting is just fine in query analyzer.
The message I receive is: "Incorrect syntax near 's'." and also
"Unclosed quotation mark before the character string ''."
If I just do : Exec MySproc 'arg1','heres arg2','arg3'
Then everything is fine.
So why doesn't escaping the single quote work in this case, where as it does
for string literals in regular queries?
What's the proper way to escape this?
- Next message: Vishal Parkar: "Re: Using OSQL"
- Previous message: Louis: "Re: Views inside Stored procedure"
- Next in thread: Adam Machanic: "Re: Sproc parameter: escaping ' character"
- Reply: Adam Machanic: "Re: Sproc parameter: escaping ' character"
- Reply: Marina: "Re: Sproc parameter: escaping ' character"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|