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 - 2005-09-20 : 07:10:09
|
| CLAUDIO writes "How can I write something similar to the below reported ...workingSELECT *FROM XTBLWHERE XTBL.A = 'A'IF SOMETHING HAPPENS THEN AND XTBL.B = 'B'END" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-20 : 07:21:21
|
| [code]If exists(SELECT * FROM XTBL WHERE XTBL.A = 'A') SELECT * FROM XTBL WHERE XTBL.A = 'A' AND XTBL.B = 'B'[/code]MadhivananFailing to plan is Planning to fail |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2005-09-20 : 09:56:16
|
Something like this maybe?DECLARE @Foo varchar(10) = NULLSELECT <List>FROM XTBLWHERE XTBL.A = 'A'AND XTBL.B = CASE @Foo WHEN NULL THEN XTLB.B ELSE @Foo END Help us help YOU!Read this blog entry for more details: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx*need more coffee*SELECT * FROM Users WHERE CLUE > 0(0 row(s) affected) |
 |
|
|
|
|
|