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)
 Help! - Search Table By Delimited String

Author  Topic 

opusid
Starting Member

4 Posts

Posted - 2007-11-27 : 10:39:28
Hi Guys

Just a small problem, but not having much luck. I need a stored proceedure which will search a table containing the following fields using a string supplied by asp.

String

LU1,LU2,LU3,LU4,LU5 - the string can be any length (well within reason anyway)

Table (name: traderspostcodes)

PrimerID (int) - example: '12'
Postcode (navarchar) - example 'LU1 2CD'
TraderID (int) - example: '234'

What I need is to know the number of records which match any of the variables in the supplied string.

Kind regards



Steve


khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-11-28 : 00:02:32
you can use the split function here to extract the value
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-11-28 : 01:48:30
http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm

Madhivanan

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

- Advertisement -