When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

Software Developer/Programmer - Interview NOW! Need 10 People!
Next Step Systems
US-IL-Des Plaines

Justtechjobs.com Post A Job | Post A Resume

The SQL Guru Answers your Questions...


Today's question comes from Eric L.:

I have a question for you. I have been working on this one for a very long time and still have no answers. I have a comma delimited string that I wish to a SQL Server 7.0 Stored Procedure, ex. '1,2,3,4'. I wish to then use this within the where clause like, select * from table where idno in (@stringpassed). I have not been able to get this to work with any methods that I have tried. Can this be done?

Eric,

Yep, you can use the EXEC command to do this. In addition to prefixing stored procedure calls, this command can be used to execute a SQL statement in a string or a string variable. I've included a sample stored proc below...

CREATE PROC Foo
  @stringpassed
AS
BEGIN
  DECLARE @SQL varchar(100)
  SET @SQL = 'SELECT * FROM table WHERE idno IN ' + @stringpassed

  EXEC(@SQL)
END

You can find more information in SQL Server books online.

Sean


Read Other SQL Guru Questions


Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers