IF THEN ELSE IN SQL
HI,
I WANT A SELECT QUERY TO BE EXECUTED WHEN SOME CONDITION IS TRUE.
SO IS THERE ANY WAY TO WRITE A SELECT STATEMENT INSIDE IF?
ANY HELP WUD BE APPRECIATED,
REGARDS
May 24th, 2011 8:16am
if @par=1
select * from tbl........
if @par=2
select * from tbl........
Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
May 24th, 2011 8:17am
T-sql forum:
http://social.msdn.microsoft.com/Forums/is/transactsql/threads
This is not a reporting services related question.
On the other hand Uri's solution works just fine.
PS. Your shift key seems to be stuck.
May 24th, 2011 8:49am