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-03-02 : 07:58:50
|
| Fernando writes "I get an error when I try to execute the next query, I'm not sure if I can include an order by statement in a conditional if, maybe that's the error:declare @cenco char(6)set @cenco = '113200'if (@cenco) <> '112601' (select TOP 1 uno, dos from X where dos like 'something%' and tres = @cenco order by dos desc)else (select TOP 1 uno, dos from X where tres = @cenco order by dos desc)The question is: ¿can I include an order by statement in a conditional if?Thanks." |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-03-02 : 08:56:07
|
| What's the error you are getting? Looks fine to me. Not sure if the parens around each SELECT might be causing a syntax error, though; they are not needed.- Jeff |
 |
|
|
|
|
|