[thelist] mssql stored procedure-using a variable for 'AND'and'OR'

Ken Schaefer Ken at adOpenStatic.com
Tue Aug 26 00:33:54 CDT 2008

> -----Original Message-----
> From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org]
> On Behalf Of Joel D Canfield
> Subject: Re: [thelist] mssql stored procedure-using a variable for
> 'AND'and'OR'
> > > it's not, it's classic ASP. what next?
> >
> > If you still trust me
> deed I do :)

The only thing I can think of is to write the most robust string parsing code you can :-(

> but for allowing the user to input anywhere from one to N search terms,
> that I'm still wuzzy on

The basic technique is to pass the whole string into the sproc as a single parameter.

In the sproc you have code that parses the string, separating out each term.

You also have your SQL statement stored in a variable in the sproc, and concatenate everything together.

You then use exec() to execute the SQL statement.


More information about the thelist mailing list