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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-02-24 : 09:35:01
|
| Patrik writes "Hi. I need something like a CASE switch in the WHERE clause.I have a aspx page passing values down from selectboxes to a stored procedure, and a sqldatareader getting the data out.When one of the selectbox passes the value -1 down to the stored procedure, then I dont want that to appear in the WHERE clause or anyway dont affect it. -1 means no value has been selected from the user. But when the number is over -1 the user has made a selection and it should be appended to the WHERE clause. I tried with CASE in the WHERE clause, but found out it dont work. I could make a string and tie the SELECT with WHERE, based on the data from the selectboxes, in the string and then execute the string, but I dont find that as a good solution.Do you have a better solution?Best regardsPatrik Sundborn" |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2006-02-24 : 10:29:22
|
| search here for 'optional' parameters....some code snippets have been posted showing how to solve the problem. |
 |
|
|
|
|
|