如何查看Sybase中的列元数据? [英] How do I look at column metadata in Sybase?

查看:109
本文介绍了如何查看Sybase中的列元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个同事给我的列列表,但是这些列驻留在数据库的不同表中. Sybase中是否有某种工具可以查询列所属的表?

I have a list of columns a co-worker has given to me, but these columns reside in different tables in the DB. Is there some kind of tool in Sybase where I can query the table a column belongs to?

(我已经尝试使用Google-ing这种工具,但到目前为止还算不上运气)

(I've tried Google-ing for this kind of tool, but no luck so far)

推荐答案

syscolumns保存列元数据.

syscolumns holds column metadata.

从syscolumns中选择*,其中name =;

select * from syscolumns where name = ;

syscolumns中的id列是sysobjects中该列的表的ID;

The id column in syscolumns is the id of the column's table, in sysobjects;

select b.name as tablename, a.name as columnname
from syscolumns a join systables b on (a.id = b.id) 
where b.type='U' and b.name = 'foo';

获取名为"foo"的表的所有列.类型='U'将其限制为用户表.

gets all columns for the table named 'foo'. The type = 'U' limits it to user tables.

select b.name as tablename, a.name as columnname
from syscolumns a join systables b on (a.id = b.id) 
where b.type='U' and a.name = 'foo';

获取所有名为"foo"的列.

gets all columns named 'foo'.

当前的大多数ASE版本将使用sysbojects而不是systables

Most current version of ASE will use sysbojects instead of systables

这篇关于如何查看Sybase中的列元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆