I need to run a select statement and if that select statement return nothing, I would like to run another different select statement :
IF EXISTS (select something from TABLE_A) THEN select something from TABLE_A;
ELSE
select something from TABLE_B;
END IF;
More from StackOverflow :IF NOT EXISTS (SELECT ...)
BEGIN
INSERT ...
END
And with more control :IF EXISTS (SELECT ...)
BEGIN
PRINT 'Do nothing.';
END
ELSE
BEGIN
INSERT ...
END