Teradata 和 SAS 以及 BigInt

发布于 2024-07-23 08:09:30 字数 494 浏览 4 评论 0原文

我们有一个充满 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

放低过去 2024-07-30 08:09:30

如果无法在 SAS 端修复它,您始终可以在 Teradata 端创建一组视图来进行转换。 然后让 SAS 访问视图:

create view sas_cast_db.some_table as 
select col1, col2, cast(bigint_var as decimal(18)), col3
from real_db.some_table;

由于您有很多表,因此可以编写一些 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:

create view sas_cast_db.some_table as 
select col1, col2, cast(bigint_var as decimal(18)), col3
from real_db.some_table;

Since you have lots of tables, it may be possible to write some SQL to auto-generate these from the data dictionary.

没有你我更好 2024-07-30 08:09:30

问题是 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

剩余の解释 2024-07-30 08:09:30

示例代码

data temp1; 
   set mylib.bigclass (dbsastype= (id='char(20)'));
run;

Sample code

data temp1; 
   set mylib.bigclass (dbsastype= (id='char(20)'));
run;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文