SQL SERVER - List the schema name and Table name for a database

If you write

SELECT  * from sys.tables


It will return all the details with list of tables.






















It will not give the name of schema instead you will get schema Id.

If you want schema name write this query
SELECT '['+SCHEMA_NAME(schema_id)+'].['+name+']'AS SchemaTableFROM  sys.tables
SQL SERVER - List the schema name and Table name for a database SQL SERVER - List the schema name and Table name for a database Reviewed by kamal kumar das on February 24, 2012 Rating: 5

No comments:

ads 728x90 B
Powered by Blogger.