如何在Aginity中列出列/列类型

时间:2014-12-18 02:58:14

标签: sql netezza

我第一次在Netezza上使用Aginity Workbench。

有谁知道如何列出列和列类型?我在网上找到的典型SQL代码片段似乎不起作用。

谢谢!

1 个答案:

答案 0 :(得分:2)

这个代码段可以做你想要的。

SELECT  
tablename,
   attname       AS COL_NAME,
   b.FORMAT_TYPE AS COL_TYPE,
   attnum        AS COL_NUM
FROM _v_table a
   JOIN _v_relation_column b
   ON a.objid   = b.objid
WHERE a.tablename = 'ATT_TEST'
AND a.schema = 'ADMIN'
ORDER BY attnum;

 TABLENAME |  COL_NAME   |       COL_TYPE       | COL_NUM
-----------+-------------+----------------------+---------
 ATT_TEST  | COL_INT     | INTEGER              |       1
 ATT_TEST  | COL_NUMERIC | NUMERIC(10,2)        |       2
 ATT_TEST  | COL_VARCHAR | CHARACTER VARYING(5) |       3
 ATT_TEST  | COL_DATE    | DATE                 |       4
(4 rows)