Teradata 和 SAS 以及 BigInt
我们有一个充满 BIGINT 数据类型的 Teradata 数据库。 SAS 是该组织的主要分析引擎。 SAS 访问库因 BIGINT 而阻塞,因此强制所有代码在将变量返回到 SAS 之前将其转换为整数或小数。 示例:
proc sql;
connect to database (blah blah);
create table sas_dataset as
select * from connection to database(
select
cast(bigint_var as integer),
varchar_var,
char_var,
from some_table
);
disconnect from database;
quit;
有谁知道解决这个问题的方法吗? 可能是用于转换变量或 SAS 访问修复的宏? 请记住,该数据库中有数千个 bigint 变量,因此不可能对数据库进行更改。
We have a teradata database that is filled with BIGINT datatypes. SAS is the primary analytic engine for the organization. The SAS access library chokes on BIGINT and therefore forces all code to cast variables into a integer or decimal before returning them to SAS. Example:
proc sql;
connect to database (blah blah);
create table sas_dataset as
select * from connection to database(
select
cast(bigint_var as integer),
varchar_var,
char_var,
from some_table
);
disconnect from database;
quit;
Does anyone know a way to fix this? Possibly a macro for casting variables or SAS access fix? Keep in mind that there are literally thousands of variables in this database that are bigint and making changes to the database is out of the question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果无法在 SAS 端修复它,您始终可以在 Teradata 端创建一组视图来进行转换。 然后让 SAS 访问视图:
由于您有很多表,因此可以编写一些 SQL 来从数据字典自动生成这些表。
If you can't fix it on the SAS side, you can always create a set of views on the Teradata side to do the casting. Then have SAS access the views:
Since you have lots of tables, it may be possible to write some SQL to auto-generate these from the data dictionary.
问题是 SAS 最多只能处理 BIGINT 数据类型的 15 位数字。
SAS 为 SAS 9.2(上面提到的一个)提供了一些针对此问题的解决方法。 您还可以让 SAS 平台管理员安排更新 SAS 服务器,以便将 BIGINT 字段截断为 15 位数字(有明显的注意事项),或者更新您的 LIBNAME 语句以将所有 BIGINT 设置为自动转换。
http://support.sas.com/kb/39/831.html
The issue is that SAS can only handle a maximum of 15 digits for a BIGINT data type.
SAS have provided a few work-arounds for SAS 9.2 (one mentioned above) for this issue. You can also get your SAS Platform Admin to arrange for the SAS server to be updated so that it truncates the BIGINT fields to 15 digits (obvious caveats apply), or update your LIBNAME statement to set all BIGINTs to be cast automatically.
http://support.sas.com/kb/39/831.html
示例代码
Sample code