Solved

comma delimited string in where clause

Posted on 2012-04-02
2
1,345 Views
Last Modified: 2012-06-27
Hello All,

Trying to write a stored procedure that will works as follows,

propertyid is a asp.net arraylist converted to comma delimited string ex: dc,me,dp
buildingis is a asp.net arraylist converted to comma delimited string  ex: tmc,omm,ccd

The table column default value for both is "All"

@propertycode As nvarchar(256),
@buildingcode As nvarchar(256)

I tried the slpit function from here but had no success.
http://www.codeproject.com/Articles/30681/Split-parameter-string-from-comma-seperator-in-SQL

SELECT propertyName, propetyId from tblproperties Where
(propertycode IN (select * from UF_CSVToTable(@propertycode)) And buildingCode IN (select * from UF_CSVToTable(@buildingcode))Or propertyCode = 'All') or
(propertycode IN (select * from UF_CSVToTable(@propertycode)) and buildingCode ='All' )

Thanks for reviewing my question.
0
Comment
Question by:GrantBailey
2 Comments
 
LVL 9

Accepted Solution

by:
mimran18 earned 500 total points
ID: 37799372
0
 

Author Closing Comment

by:GrantBailey
ID: 37801336
Fantastic! Thank you.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question