如何从Sybase数据库中获取表描述(字段名称和类型)? [英] From a Sybase Database, how I can get table description ( field names and types)?

查看:862
本文介绍了如何从Sybase数据库中获取表描述(字段名称和类型)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以访问命令行isql,并且我想获取给定数据库的所有表的元数据,可能是格式化文件.我该如何实现?

I have access to command line isql and I like to get Meta-Data of all the tables of a given database, possibly in a formatted file. How I can achieve that?

谢谢.

推荐答案

检查 此处是Sybase系统表的图.

Here is a diagram of Sybase system tables.

所有用户表的列表:

SELECT * FROM sysobjects WHERE type = 'U'

您可以将'U'更改为其他对象:

You can change 'U' to other objects:

  • C –计算列
  • D –默认
  • F – SQLJ函数
  • L –记录
  • N –分区条件
  • P – Transact-SQL或SQLJ过程
  • PR –准备对象(由Dynamic SQL创建)
  • R –规则
  • RI –参照约束
  • S –系统表
  • TR –触发
  • U –用户表
  • V –视图
  • XP –扩展存储过程
  • C – computed column
  • D – default
  • F – SQLJ function
  • L – log
  • N – partition condition
  • P – Transact-SQL or SQLJ procedure
  • PR – prepare objects (created by Dynamic SQL)
  • R – rule
  • RI – referential constraint
  • S – system table
  • TR – trigger
  • U – user table
  • V – view
  • XP – extended stored procedure

表中的列列表:

SELECT sc.* 
FROM syscolumns sc
INNER JOIN sysobjects so ON sc.id = so.id
WHERE so.name = 'my_table_name'

这篇关于如何从Sybase数据库中获取表描述(字段名称和类型)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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