Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-11-11 : 12:13:52
|
Matt writes "Hi there,
I wnat to implement a stored procedure that uses the IN statement to select all records that return an ID that matches the ID supplied in the IN statement. ie;
SELECT DISTINCT category_id, suburb_id, category_name FROM vw_SELECT_CATEGORIES_AVAILABLE WHERE state_id = 1 AND suburb_id IN (2,3) order by category_id
Now I have made this into a stored proc which I call from an ASP page like this:
conn.execute("sproc_SELECT_CATEGORIES " & stateid & ", " & suburbid)
The thing is suburbid has multiple comma deliminated values such as 1, 2, 3, 4 and so on. If I put brackets around the suburbid [] it works butonly retreives the first value (I also declare the variable in the Stored Proc as nvarchar as it wont take an int value - I guess this is half my problem...)
So at the moment Im just calling it from my asp page as the whole select statement that you see in the second paragraph....but Id much rather a stored proc!!
Any feedback would be greatly appreciated
Regards,
MAtt" |
|
|
|
|
|