我目前正在一个双盲的环境中工作。
我需要找出如何确定特定表上存在哪些索引。我会使用sp_helpindex
,但显然它在SyBase的实例上不存在。
我们相信它是SyBase 12,但我再也无法确定。
有没有人有SQL ... - 确切确认我们正在研究的SyBase版本是什么? - 给定表存在的所有索引的详细信息?
要“确切地确认我们正在研究什么版本的SyBase?”
为什么不使用:
选择@@版本
Sybase网站已关闭(至少在这里),但它会是这样的:
IQ SHOW INDEXSET INDEXES
要么
IQ SHOW INDEXSET FOR indexset
其中indexset
是tablename
,因为每个表都有一个分配了相同名称的索引集。
如果你有权访问sybase网站,你可以进一步:)
大多数Sybase产品都有一个-v命令行参数来告诉版本是否运行引擎。
要在任何表上查找索引,请输入以下内容,其中my_table
是表的名称:
select i.name
from sysindexes i, sysobjects o
where o.name = 'my_table'
and o.id = i.id
您可以使用此查询:
select i.name
from sysindexes i, sysobjects o
where o.name = 'table_name' and i.indid >=1
and o.id = i.id
在多个表上查找索引,而不是像图像索引
select name = o.name,iname = i.name from sysindexes i, sysobjects o where o.name in ('table1','table2','table3') and i.name not like 't%' and i.indid >=1 and o.id = i.id
对于sybase版本:
select @@version
在Sybase版SAP IQ / 16中,您可以获取以下索引列表(表名my_table区分大小写:
select *
from sys.sysindexes
where tname = 'my_table';
select * from sys.sysindexes where tname='Your Table name'
试试上面的代码,它对我有用。