Wednesday, January 21, 2004

Do you know this?

We can get complete information about each table in a database using the following syntax:

Execute sp_help <<tablename>>

But if we have hundreds of tables in a database then the above method would surely be a tedious way to do. So to over come that we could use the following query:

Execute sp_MSForeachTable @command1 = "sp_help '?'"

As sp_help lists information about a single table this sp_MSForeachTable displays all information about all tables within the existing database. Neat isn’t it?

No comments: