Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored procedures and variables

Status
Not open for further replies.

tvbruwae

Programmer
Aug 9, 2001
224
0
0
EU
Hi

We have successfully migrated a SQL 6.5 stored procedure to SQL 2000. This SP is called from an ASP web page, which also passes some parameters. However we are having problems using these parameters in a select clause.

Basically the SP looks like this (at least the relevant parts):
Code:
CREATE PROCEDURE GetArticles (@Article varchar(16)="",..., @ArtText varchar(40) = "") AS
....
Select <...> where (Articles.ArtText like @ArtText)
This last line used to work in 6.5 but now we are having problems with the "like" structure. Basically the @ArtText parameter contains a string (empty or not) with a %-sign both in front and at the end.
So it looks like %%, %test%, etc. Unfortunately we get no data at all when executing the SP. We tried different approaches with the quotes (add single quotes to the parameter, but quotes around @ArtText, etc.) but nothing seems to work. Does anyone know how to make a like-clause work with a parameter?

Thanks!
 
This is a double post. Please do not respond here. See THREAD962-1014767

Thanks,

SQLBill

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top