Wednesday, March 7, 2012

fast query

Hi,
What the best and fast way to check if a table has rows?
ThanksIF EXISTS (SELECT * FROM YOURTABLE)
Andrew J. Kelly SQL MVP
"Chris" <Chris@.discussions.microsoft.com> wrote in message
news:0F19B2E9-7FE3-4544-91D7-23DB17906787@.microsoft.com...
> Hi,
> What the best and fast way to check if a table has rows?
> Thanks
>|||You can use:
1-. select count(*) from [table name]
2-. exec sp_spaceused '[table name]'
Edgardo Valdez
MCSD, MCDBA, MCSE
"Chris" wrote:

> Hi,
> What the best and fast way to check if a table has rows?
> Thanks
>|||if exists(select top 1 field from table)
"Chris" wrote:

> Hi,
> What the best and fast way to check if a table has rows?
> Thanks
>

No comments:

Post a Comment