For this question, I would just do an inline sql query in ColdFusion and use a coldfusion variable for the tablename:
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]

Reply via email to