jwcolby
jwcolby at colbyconsulting.com
Wed Jul 25 21:19:01 CDT 2012
Thanks Francisco. John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it On 7/25/2012 10:05 PM, Francisco Tapia wrote: > Try this approach: > > http://sqlthis.blogspot.com/2011/01/lighting-quick-table-rowcounts-for-your.html?m=1 > > Sent from my mobile device > > On Jul 25, 2012, at 5:08 PM, jwcolby <jwcolby at colbyconsulting.com> wrote: > >> In a stored procedure I need to get a count of the records in a table where the table name is passed in to the SP. >> >> I tried: >> >> DECLARE @RecordCnt int >> >> SELECT @RecordCnt = Count([Column 0]) FROM @TblName >> >> Where @TblName is the passed in table name. >> >> This fails telling me that I have to declare a table variable @TblName >> >> Is there a simple way to do what I am trying to do? >> -- >> John W. Colby >> Colby Consulting >> >> Reality is what refuses to go away >> when you do not believe in it >> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > >