October 30, 2002 at 4:21 pm
Hello,
In QA if I call a procedure as
EXEC stpMySproc ' WHERE CompanyName LIKE ' + Char(39) + 'haas%' + Char(39)
It fails... however if I instead do this
Declare @X as varchar(255)
SET @X = ' WHERE CompanyName LIKE ' + Char(39) + 'haas%' + Char(39)
EXEC stpMySproc @X
it runs fine... why would that be?
I want to just call it in a single line as I'm Calling it for an MS Access ADP Listbox.
btw, the error I get is this:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '+'.
Thanks,
-Francisco
-Francisco
November 1, 2002 at 3:41 pm
You can't use functions in the EXEC statement. I assume char(39) is a ' in which case use 2 of them i.e
EXEC stpMySproc ' WHERE CompanyName LIKE ''haas%'''
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
November 1, 2002 at 3:44 pm
Thank you so much for posting a reply.. I must appologize as I had double posted.. I couldn't find the right forumn to post to thus I put it here... next I couldn't figure out how to delete my post sorry again..
this is the link to this post which introduced a concern with a malformed where clause...
thank you again for answering and sorry for the trouble...
-Francisco
-Francisco
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply