自动列出在tmstamp上所缺失索引的创建语句
发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,SELECT o.name,user_name(o.uid),'ALTER TABLE [dbo].'+'['+object_name(co.id) /*tbname*/+']'+' ADD CONS
千家信息网最后更新 2026年11月03日自动列出在tmstamp上所缺失索引的创建语句SELECT o.name,user_name(o.uid),'ALTER TABLE [dbo].'+'['+object_name(co.id) /*tbname*/+']'+' ADD CONSTRAINT [TM_UNIQUE_'+''+upper(object_name(co.id))+'] UNIQUE NONCLUSTERED ('+upper(co.name) /*colname*/+' ASC)'
FROM syscolumns co
inner join sysobjects o
on co.id=o.id and o.xtype='U' and o.name<>'dtproperties'
WHERE co.name='TMSTAMP' and user_name(o.uid)='dbo' --order by o.name
and object_name(co.id) not in (
select tab.Name as Tab_Name
from sys.indexes ind
inner join sys.tables tab on ind.Object_id = tab.object_id and ind.type in (1,2)
inner join sys.index_columns index_columns on tab.object_id = index_columns.object_id and ind.index_id = index_columns.index_id
inner join sys.columns Col on tab.object_id = Col.object_id and index_columns.column_id = Col.column_id
left join sysobjects o on tab.name=o.name and o.type='U'
where Col.Name='TMSTAMP' and user_name(o.uid)='dbo' --order by tab.name
) order by object_name(co.id)
FROM syscolumns co
inner join sysobjects o
on co.id=o.id and o.xtype='U' and o.name<>'dtproperties'
WHERE co.name='TMSTAMP' and user_name(o.uid)='dbo' --order by o.name
and object_name(co.id) not in (
select tab.Name as Tab_Name
from sys.indexes ind
inner join sys.tables tab on ind.Object_id = tab.object_id and ind.type in (1,2)
inner join sys.index_columns index_columns on tab.object_id = index_columns.object_id and ind.index_id = index_columns.index_id
inner join sys.columns Col on tab.object_id = Col.object_id and index_columns.column_id = Col.column_id
left join sysobjects o on tab.name=o.name and o.type='U'
where Col.Name='TMSTAMP' and user_name(o.uid)='dbo' --order by tab.name
) order by object_name(co.id)
索引
缺失
语句
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
互联网与科技
互联网科技图片
为想互联网科技怎么样
互联网是不是新科技
万易互联网科技
美国互联网科技
宜安科技 互联网金融
百单互联网科技有限公司
美国互联网黑科技
奔汉互联网科技
郑州华宇互联网科技
亿人帮互联网科技
美国互联网前沿科技
深圳卡尔迅互联网科技有限公司怎么样
开启互联网科技时代小说
河南猎农互联网科技有限公司
黑科技闪耀互联网之光
速维有品互联网信息科技(苏州)有限公司
互联网金融金融科技
青岛互联网科技园
互联网科技有限公司经营范围
银优互联网科技有限公司
齐家互联网科技有限公司
浙江互联网科技研学营
移动互联网年度科技创新
广州千川互联网科技有限公司
全球科技与互联网公司市值变化
北京天晋互联网科技有限公司
黑龙江互联网科技公司
优雇互联网科技有限公司