How to check if a table has at least one record in it ?
Posted on 2015-02-17
I have a table, and I want to know if it has at least one record in it. If it the table does not have a record, then I want sql code execution to exit the stored procedure.
I came up with the following code, however I don't know if it is correct or not? I need help from an expert.
-- Code below is from stored procedure.
if not exists (select top 1 uid
where uid IS NOT NULL)