I have 50+ tables in a database.
I don't want to use the following SQL on each table in a database.
select * from {table_name}
So, is it possible to display the first 10 records for each table inside the same database using sql?
|
I have 50+ tables in a database. I don't want to use the following SQL on each table in a database.
So, is it possible to display the first 10 records for each table inside the same database using sql? |
|||||||||||
|
|
I'd be careful about using Instead I would do something like this (which also includes the table name in the output, probably useful):
When you're satisfied with the |
|||
|
|
|
Use sp_MSforeachtable
To show the table Name you should change it like this :
|
|||||||||||||
|
|
sp_MSforeachtable is great. but if you want to somehow limit which tables to look at (for example, just 'dbo' schema) you can generate select scripts like this:
|
|||||
|
|