IT Community - Software Programming, Web Development and Technical Support

Using arrays in stored procedures

This is a discussion on Using arrays in stored procedures within the Database Support forums, part of the Web Development category; i want to call a stored procedure sending array of integers as parameter now in stored procedure i want to ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 02-09-2008, 06:45 AM
it.wily it.wily is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
it.wily is on a distinguished road
Default Using arrays in stored procedures

i want to call a stored procedure sending array of integers as
parameter

now in stored procedure i want to execute

Code:

select * from Products where Prod_Code IN

(sent array)

means "sent array" stores values i want to check in query

please help
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-09-2008, 06:47 AM
it.wily it.wily is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
it.wily is on a distinguished road
Default Re: Using arrays in stored procedures

Send them as a string of comma seperated values instead of an array. Then, in your sp, do this:

Code:

declare @sql varchar(1000)
Set @sql = 'Select * From Products Where Prod_Code IN (' + @values + ')'
exec(@sql)

Where @values is your parameter.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-09-2008, 10:18 AM
rick22 rick22 is offline
D-Web Trainee
 
Join Date: Feb 2008
Posts: 21
rick22 is on a distinguished road
Default Re: Using arrays in stored procedures

try out the following code this thing will definitely work out:

declare @sql varchar(1000)
Set @sql = 'Select * From Products Where Prod_Code IN (' + @values + ')'
exec(@sql)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete all stored procedures in a Database oxygen Database Support 1 03-05-2008 02:35 AM
NET Code generators for C# and SQL Stored Procedures verrock_po ASP and ASP.NET Programming 1 12-06-2007 12:22 AM
Using arrays in stored procedures oxygen Database Support 1 11-26-2007 08:01 AM
SQL Server Undocumented Stored Procedures a.deeban Database Support 3 09-04-2007 03:31 AM
Executing SQL Server Stored Procedures With PHP - Executing stored procedures Jeyaseelansarc PHP Programming 1 07-19-2007 12:23 AM


All times are GMT -7. The time now is 09:04 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0