I have the following which throws an error if the table Tru.Repo does not exist:
IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'Tru' AND TABLE_NAME = 'Repo')) OR
(NOT EXISTS (SELECT * FROM Tru.Repo WHERE RepoName = 'Tru.Repo'))
BEGIN
print('in')
END
but I would expect that if Tru.Repo does not exist, the first statement is true so why does it then execute the second statement? Is there anyway of getting around this using a single IF block?