该查询脚本包含以下内容(sqlserver2005):
1、查询库中所有表
2、查询库中所有表的数据(根据主键排序)
3、查询库中所有没有主键表
4、将库中所有没有主键表加上主键
5、导出库中所有外键关系重建脚本
6、删除所有外键关系
7、查询库中所有具有聚集索引的表
8、查询库中出现过的字段类型
9、查询某个字段类型在那些表中出现过
10、删除库中所有表的数据
11、查询存在计算列(包括列名和表名)
12、常用操作脚本
13、查询日志中出现过表的所有数据(根据主键排序)
 
常用查询(一):查看是否有计算列、出现过的字段类型、含有聚集索引的表
一、查看是否有计算列:
select distinct object_name(c.id) from syscolumns c where iscomputed = 1 and objectproperty(c.id,'IsUserTable') = 1
 
二、查询库中出现过的字段类型:
select distinct c.xtype,t.name from syscolumns c
left join systypes t on c.xtype = t.xtype where objectproperty(c.id,'IsUserTable') = 1
 
三、查询库中含有聚集索引的表:
declare   @tableName   varchar(200)  
declare   tb_cursor   cursor      for
select name from sysobjects where xtype ='U' and name <> 'dtproperties'
open   tb_cursor  
fetch   next   from   tb_cursor   into   @tableName;
while   @@fetch_status = 0
begin
if (objectproperty(object_id(@tableName),'TableHasClustIndex') = 1)
begin
print @tableName
end
fetch   next   from   tb_cursor   into   @tableName;
end 
close   tb_cursor
deallocate  tb_cursor
 
(该脚本对你有任何帮助,或需要其他功能脚本,请直接回复)