Sybase列出用户所有表及表字段

作者:hee
网址:


JDBC里提供的DatabaseMetaData类提供的方法可以方便的完成这事,但有时候数据库因权限问题自己不能完全控制,用这个类会有问题。

同样用SQL也可以完成这个问题:

-- 列用户所有表:
select name as tn from sysobjects where type='U'

-- 列某个表所有字段及类型,是否允许空等:
select a.colid as id, b.name as tab_name ,
a.name as COLUMN_NAME,
c.name as DATA_TYPE,
a.length as COLUMN_SIZE,
a.prec as length,
a.scale,
case isnull(a.status,0) when 0 then 'NOT NULL' ELSE 'NULL' END AS NULLABLE 
from syscolumns a, sysobjects b, systypes c 
where a.id = b.id and a.usertype = c.usertype and b.name= 'TargetTable' 
order by a.colid
  • ---> 收藏到书签 
 | 这篇【Sybase列出用户所有表及表字段】来自 www.since2006.com |



本文相关评论|Comments

发表该文评论|Send Comment

关于本文|About The Blog

这篇 Blog 于 2010-03-24 10:20:00 发布在 since2006.com
上一篇: Activity生命周期
下一篇: 解决Nginx 500错误
首页

相关文章|Related Articles

  • 没有相关文章


相关标签|Related Tags

页面查询:12次,耗时:0.02秒