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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 passing array to SQL

Author  Topic 

NewCents
Starting Member

19 Posts

Posted - 2006-01-16 : 18:42:12
I have a listbox where the user can choose from 1 to n countries. What would be the best way to pass the countries the user has selected to SQL?

Thank you for any help

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2006-01-16 : 18:44:22
You could pass in a comma separated value string into your stored procedure and split the string using a user defined function.
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-01-16 : 18:52:20
see this

http://sqlteam.com/forums/topic.asp?TOPIC_ID=50648
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-17 : 01:09:13
If you want to select the records that have selected countries, then

Select columns from yourTable where ','+CountryCol+',' like '%,'+@CSV+',%'

Also search for Where in @MYCSV in this topic
http://sqlteam.com/forums/topic.asp?TOPIC_ID=55210

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -