Reputation: 15
I need to know the number of rows in a certain table. If it is under 250 rows I need to return an error to the sql job forcing it to quit. The problem is it's not a stored procedure. It's sql code is running straight from the job step as a Transact-SQL script. Is this possible to return anything, or is there a better way to do this?
This is what I have: select case when (select cnt = count([col]) from db.dbo.table) < 250 THEN 1 ELSE 0 END
Upvotes: 0
Views: 91