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 |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-04-26 : 08:24:10
|
| Is there a single liner SELECT that will pull all records where ColumnA = @ColumnA but if none are found, then choose WHERE ColumnA = 0I can't do it without using: IF EXISTS BEGIN END ELSE BEGIN ENDSam |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2005-04-26 : 08:36:03
|
| Yeah, you can doSELECT * FROM yourtable WHERE((SELECT count(*) as checker from yourtable WHERE columnA = @columna) = 0 AND ColumnA = 0)OR ColumnA = @ColumnAThough I think I wrote a more efficient way of doing this on this forum not long ago.-------Moo. :) |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-04-26 : 08:38:33
|
| Way cool... |
 |
|
|
|
|
|