[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

comma delimited string in where clause

Posted on 2012-04-02
2
Medium Priority
?
1,361 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

650 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