select count(*)
from #tablename#
However, if it must be done in a stored procedure, then the following should work:
@sqlstring varchar(255)
SELECT @sqlstring = 'SELECT count(*) FROM' + @varTableName
EXEC @sqlstring
Glad I could be of help.
Cheers!
Ali
> Now the final question. How do yousuccessfully pass a table name
> dynamiclly gereated as a varible in the FROM portion of a SELECT
> clause?
>
> ie.
>
> SELECT count(*)
>
> FROM @varTableName
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

