I created a temp table in my procedure that i insert data into in the initial part of my procedure. After I insert the selected data into the temp table I'm trying to find out how to determine if the temp table is empty or not. If it is not empty it will begin emailing me the data (which i already created the code for) but if it is empty then it will do nothing. So I just can't figure out how to determine whether or not the temp table is null or not and then have it continue the procedure depending on if the temp table is null or not. This is what i tried so far but with no suceess (#NoMasKey is my temp table):
Any ideas as to why this doesn't work or what I should? Does this make sense? Thanks for your time!!
Code:
(here i insert selected data into #NoMasKey)
IF
object_id('#NoMasKey') is not null
BEGIN
(here is where i have the rest of the code i want to complete if the table is not null (empty)
Any ideas as to why this doesn't work or what I should? Does this make sense? Thanks for your time!!