I'm fairly new at SQL so I'm not sure if this is the correct way to write this. I have several queries that I want to join with UNIONs but I also need to run an IF EXISTS on each one first. The way I have it written now is
IF EXISTS(query 1)
BEGIN
query 1
END
ELSE
CREATE TABLE...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.