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 ORDER BY name