Hi @BeUnique
Don't know what your table like, maybe you could try something like this:
CREATE OR ALTER PROC sp_test
AS
DECLARE @RowCount1 INT
DECLARE @RowCount2 INT
SELECT @RowCount1=COUNT(*) FROM Table1;
SELECT @RowCount2=COUNT(*) FROM Table2;
IF @RowCount1 > @RowCount2
......
ELSE
......
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.