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 |
|
andrewcw
Posting Yak Master
133 Posts |
Posted - 2012-02-07 : 23:04:11
|
| Hi allOne of my 7 input parameters has an integer value, where the value if 0 means all values for that field.Its possible to split the query if @theIntegerValue =0Select - big long query with where ... elseSelect - big long query with where AND (theVal= @theIntegerValue)This is probably a familiar pattern, but I cant think of a way to get around the issue as I can with a like '%@MightBeEmptyString' to avoid making the if statementThanks !andrewcw |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
Kristen
Test
22859 Posts |
Posted - 2012-02-08 : 03:33:24
|
| Use Dynamic SQL ? |
 |
|
|
|
|
|