?
Solved

comma delimited string in where clause

Posted on 2012-04-02
2
Medium Priority
?
1,359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
mimran18 earned 2000 total points
ID: 37799372
0
 

Author Closing Comment

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

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Suggested Courses

762 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