当前位置: 代码迷 >> Sql Server >> 判断两个表的重名目录是否存在
  详细解决方案

判断两个表的重名目录是否存在

热度:100   发布时间:2016-04-24 21:27:13.0
判断两个表的重名索引是否存在

现在在有2个婊 tab1和 tab2,对这两个表的某个属性建立索引,起名都叫tab_index

我心中要判断这两个索引是不是存在。是要分别判断tab1和 tab2的tab_index是否存在,不是判断只要存在tab_index就行,
谢谢
sql?索引?重名?判断

------解决方案--------------------
select distinct sys.tables.name, sys.indexes.name from sys.tables
inner join sys.indexes on sys.tables.object_id = sys.indexes.object_id
and sys.indexes.name = 'tab_index'
where sys.tables.name in ('tab1', 'tab2')
  相关解决方案