The 'quick' way to count the rows in a table is to look up the index stats. However, I imagine that's probably a 'extra credit' type answer :) It doesn't evaluate the rows in table so when you have multi million (or billion) row structures it's a life saver.
Something like this:
[Table_name] = OBJECT_NAME(so.[object_Id])
, [Rows] = SUM ([row_count])
sys.dm_db_partition_stats AS ss
JOIN sys.objects AS so ON so.[object_id] = ss.[object_id]
so.[type] = 'U'
AND so.[is_ms_shipped] = 0
AND [index_id] IN (0, 1)
Msg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.http://nosqlsolution.blogspot.co.uk/