List all tables in a database

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.

FROM sys.tables ORDER BY name
[tweetmeme only_single=”false”]

Got something to add?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s