troubleshooting Question

Something similar to VB's AndAlso / OrElse in SQL Server

Avatar of LandyJ
LandyJFlag for United States of America asked on
Microsoft SQL Server
5 Comments1 Solution4936 ViewsLast Modified:
Is there an operator in SQL Server that is similar to VB's AndAlso or OrElse?  Something where if the first condition is true, it stops evaulating the statement?

IF Object_ID('tempdb..#MyTemptable') IS NULL or (SELECT SUM(MyValue) FROM #MyTemptable) IS NULL

If #MyTempTable hasn't been created, this will fail with an error.  I've already coded around it, but I was wondering if there was such an operator in SQL?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros