[thelist] MSSQL Stored Proc problem
Scott Dexter
sgd at ti3.com
Fri Jan 3 15:45:00 CST 2003
> -----Original Message-----
> From: rudy
>
> > How can I pass the variable-length list of question_numbers to the
> > stored proc?
>
> as a single varchar parameter, containing a comma-delimited list
The sticky part here is getting the delimited list into the SELECT
statement. What we do here (at work) is play with the Exec() function,
so you'd have something like:
Exec('Select ' + <varchar column list passed in> + ' from tbTable where
<yourcolumn> IN (' + <passed in delimited list>' + ')')
Now, how efficient that is, I dunno, because it has to be evaluated and
then compiled, so I'd want to compare it to creating the SQL statement
outside of the stored proc (e.g. not using a stored proc).
Good luck--
sgd
--
TALX FasTime Services
Customized Systems for H.R., Payroll, and Employee Self Service
* Telephone/Internet Time and Attendance
* Telephone/Internet Surveys
* Automated Outbound Calling and Messages
http://www.ti3.com/TALX-Ti3/TALXTi3Fastime.htm
More information about the thelist
mailing list