Get rowcount for all tables in a database

This one a simple post, we are getting the rowcount for each table in the current database. That’s it.

--Get the rowcount for each table in the current database
IF OBJECT_ID('tempdb.dbo.#tcounts', 'U') IS NOT NULL
 DROP TABLE #tcounts; 
CREATE TABLE #tcounts (
 Table_Name nvarchar(255),
 Row_Count int
)
EXEC sp_MSForEachTable @command1='INSERT #tcounts (Table_Name, Row_Count) SELECT ''?'', COUNT(*) FROM ?'
SELECT table_name, row_count FROM #tcounts ORDER BY Table_Name
IF OBJECT_ID('tempdb.dbo.#tcounts', 'U') IS NOT NULL
 DROP TABLE #tcounts;