在Sybase中查找表的索引

问题描述 投票:1回答:6

我目前正在一个双盲的环境中工作。

  1. 我必须通过电子邮件将我需要运行的任何查询发送给客户的员工
  2. 该员工在SAS客户端中运行它们,并与SyBase建立了odbc连接

我需要找出如何确定特定表上存在哪些索引。我会使用sp_helpindex,但显然它在SyBase的实例上不存在。

我们相信它是SyBase 12,但我再也无法确定。

有没有人有SQL ... - 确切确认我们正在研究的S​​yBase版本是什么? - 给定表存在的所有索引的详细信息?

sql environment-variables sybase indexing
6个回答
1
投票

要“确切地确认我们正在研究什么版本的SyBase?”

为什么不使用:

选择@@版本


Sybase网站已关闭(至少在这里),但它会是这样的:

IQ SHOW INDEXSET INDEXES

要么

IQ SHOW INDEXSET FOR indexset

其中indexsettablename,因为每个表都有一个分配了相同名称的索引集。

如果你有权访问sybase网站,你可以进一步:)


3
投票

大多数Sybase产品都有一个-v命令行参数来告诉版本是否运行引擎。

要在任何表上查找索引,请输入以下内容,其中my_table是表的名称:

select i.name 
from sysindexes i, sysobjects o
where o.name = 'my_table'
  and o.id = i.id

0
投票

您可以使用此查询:

select i.name 
from sysindexes i, sysobjects o
where o.name = 'table_name' and i.indid >=1
and o.id = i.id

0
投票

在多个表上查找索引,而不是像图像索引

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

0
投票

对于sybase版本:

select @@version

在Sybase版SAP IQ / 16中,您可以获取以下索引列表(表名my_table区分大小写:

select *
from sys.sysindexes
where tname = 'my_table';

0
投票

select * from sys.sysindexes where tname='Your Table name'

试试上面的代码,它对我有用。

© www.soinside.com 2019 - 2024. All rights reserved.