日期:2014-05-18  浏览次数:20588 次

如何快速生成多条这类语句?
比如某个数据库中有20个表。
有什么方法,能快速生成20条这样select语句?
select top 10 * from 表1
select top 10 * from 表2
.
.
.
slect top 10 * from 表20

------解决方案--------------------
SQL code
use CSDN
go

select
    'select top 10 * from ' + quotename(name)
from sys.tables
where type = 'u'