SELECT COUNT(*) > into variable T-SQL

Viewed 19614

This should be pretty easy but for some reason I can't get the syntax right for SQL Server 2008

I need my variable to be true if a table has columns otherwise it should be false.

As of now I have this

DECLARE @LEHasSessions bit

set @LEhasSessions = ((SELECT COUNT(*) FROM @LEForSession) > 0)

which is obviously not compiling.

How should the syntax be in order to make it work?

3 Answers
Related