brgdotnet
asked on
How to check if a table has at least one record in it ?
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
from user_detail
where uid IS NOT NULL)
retur
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
from user_detail
where uid IS NOT NULL)
retur
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
if not exists (select top 1 EmptyColumn
from Table_3)
return