How to generate script to retrieve schema and only top 100 records from each table from SQL Server 2005. I need to generate scripts for 15-16 databases and each database has more than 50-60 tables. Is it possible to generate script to retrieve schema only some data in SQL Server 2005? If yes, how can I do this? Any help appreciated.
declare @query varchar(max)
set @query = ''
select @query = @query + 'select top 100 * from [' + t.name + '];' from sys.tables t order by t.name
exec (@query)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.