Is there a fast/efficiency way to check if a table is empty?
DECLARE @StartEndTimes TABLE
(
id bigint,
StartTime datetime,
EndTime datetime
)
IF @StartEndTimes IS NOT NULL
Is there a fast/efficiency way to check if a table is empty?
DECLARE @StartEndTimes TABLE
(
id bigint,
StartTime datetime,
EndTime datetime
)
IF @StartEndTimes IS NOT NULL
I think your best bet might be COUNT
DECLARE @StartEndTimes TABLE
(
id bigint,
StartTime datetime,
EndTime datetime
)
SELECT COUNT(1) FROM @StartEndTimes
Rather than counting you can;
if exists (select id from @StartEndTimes)
set @has_stuff = 1
Which will return as soon as it hits a row.