Francisco Tapia
fhtapia at gmail.com
Wed Jul 25 21:05:12 CDT 2012
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 >