获得用户表的名字user 数据库名
select name from dbo.sysobjects where type='U'user DB1
select count(*) from dbo.sysobjects where type='U'
select name from dbo.sysobjects where type='U'user DB1
select count(*) from dbo.sysobjects where type='U'
解决方案 »
- 怎样修改results的界面
- 存储过程参数前加N
- I/O统计中的扫描计数和预读是什么意思?
- 在桌面上单击"开始"菜单,指向"程序"子菜单、"Microsoft SQL Server"子菜单、"Analysis Services"子菜单,然后单击"Analysis Manager"命
- 一个关于时间和空值得问题
- Sql 查询问题
- 如何检索某字段长度小于7的纪录
- sql批量修改
- 求一条SQL语句?gz,UP,都有分.....
- vc连数据库sql server
- 一个让我很疑惑的问题!!!!
- sqlserver 2005:因为同事误操作,导致服务的内存运行值配置太低(16M),现在大家都连不上了--寻高手
select count(*) from dbo.sysobjects
set @DatabaseName = 'DB1'
declare @s varchar(8000)
select @s = case when @s is null then 'use ' + @DatabaseName else @s + ' union' end
+ ' select ''' + [name] + ''' as TableName, (select count(1) from ' + [name] + ') as Num'
from sysobjects where xtype = 'U'
exec(@s)
set @DatabaseName = 'DB1' --数据库名称
declare @s varchar(8000)
select @s = case when @s is null then 'use ' + @DatabaseName else @s + ' union' end
+ ' select ''' + [name] + ''' as 表名称, (select count(1) from ' + [name] + ') as 记录数'
from sysobjects where xtype = 'U'
exec(@s)
if object_id('tempdb..##') is not null drop table ##
select cast(null as sysname) as 表名称, 1 as 记录数 into ## where 1 = 0
declare @TableName sysname
declare testcur cursor for select [name] from sysobjects where xtype ='U' order by [name]
open testcur
fetch next from testcur into @TableName
while @@fetch_status = 0
begin
exec('insert into ## select ''' + @TableName + ''', (select count(1) from ' + @TableName + ')')
fetch next from testcur into @TableName
end
close testcur
deallocate testcur
select * from ##
drop table ##