You are here: Re: How to check if a Table is <empty> ie doesnt contain any rows « MsSQL Server « IT news, forums, messages
Re: How to check if a Table is <empty> ie doesnt contain any rows

Posted by Yas on 08/18/07 15:32

On 18 Aug, 16:22, Yas <yas...@gmail.com> wrote:
> On 18 Aug, 15:52, Yas <yas...@gmail.com> wrote:
>
> > Hi, is there a way I can check if a table is empty and contains no
> > rows?
>
> > I have a Table1 which being dynamic can sometimes end up with now
> > columns what so ever. I'm using Table1 in one of my views along with 2
> > other tables and I would like put a condition at the...something like
> > AND Table1 IS NOTEMPTY
>
> Actually could I possibly do something like the following? OR is there
> a better way?
>
> DECLARE @myCount int
> SELECT @myCount = (select count(*) FROM Table1)
>
> SELECT xyz
> FROM Table1, Table2 etc joins etc etc
>
> WHERE .... AND @mycount > 10
>

Ahhhh but the problem is I cant use DECLARE in a VIEW :-(

is there an alternative?

Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация