postgresql information_schema超过8个字符

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

在我的新工作中,他们使用 SAS,我需要获取列名称列表。

为了实现这一目标,我想在 SAS 的 postgresql 中使用 information_schema。但是,SAS 的库名称限制为 8 个字符。

这是我获取数据集的列名称的代码:

proc sql;
CREATE TABLE table_2 AS
SELECT
*
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME='table_1';
run;

这会导致以下错误:

错误:libname“information_schema”超过 8 个字符

有人能找到解决这个问题的方法吗?

谢谢你

postgresql sas information-schema
1个回答
0
投票

要获取 SAS 数据集中的变量列表,请使用 PROC CONTENTS。示例:

proc contents data=sashelp.class;
run;

如果您有一个指向 POSTGRESQL 数据库的 libref,那么您应该能够执行相同的操作。因此,如果您定义 libref POSTGRES 来指向具有名为 TABLE_1 的数据集(又名“表”)的数据库模式,那么代码就是:

proc contents data=POSTGRED.table_1 ;
run;
© www.soinside.com 2019 - 2024. All rights reserved.