|
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]
|