If you ever have the need to list all tables in your database, here is a statement that you can use.
I find it helpful if you need to loop through all the tables in your database or sometimes I need to provide a list to someone else. I have used this script when moving changes between environments as a quick check to make I didn’t forget table.s
There are many different reasons you may need a list tables.
This will return just the table name.
SELECT name AS TABLE_NAME
FROM sys.tables WHERE (type = N'U') AND (LEFT(name, 1) = N't')
ORDER BY name
posted @ Friday, October 4, 2013 11:22 AM