简体   繁体   English

SAS连接到SQL Server-ODBC

[英]SAS Connect to SQL Server - ODBC

I'm trying to connect to several SQL servers with raw SQL tables using SAS and ODBC connections. 我正在尝试使用SAS和ODBC连接使用原始SQL表连接到多个SQL服务器。 I have managed to do this by setting up my ODBC connections and running the below code however I have a couple of questions and potential requirements before I can move on, so here goes.... 我已经通过设置ODBC连接并运行下面的代码来做到这一点,但是在继续之前我有几个问题和潜在要求,所以这里是...。

LIBNAME libname ODBC DSN='SQL Server' SCHEMA=dbo READ_LOCK_TYPE=NOLOCK; LIBNAME libname ODBC DSN ='SQL Server'SCHEMA = dbo READ_LOCK_TYPE = NOLOCK;

  1. I ran the above in base SAS and got the library with the little globe as expected and how I would like. 我在基本SAS上运行了上面的代码,并获得了预期中的小地球仪以及我的期望。 When I ran in Enterprise guide there is no globe and the library is under the local server. 当我在《企业指南》中运行时,没有globe,并且该库位于本地服务器下。 Would this indicate the data is now local and not on the original server via ODBC? 这是否表明数据现在是本地数据,而不是通过ODBC在原始服务器上? If it is local is there a way to link to the data via ODBC as I do not want the raw data to be local? 如果它是本地的,是否可以通过ODBC链接到数据,因为我不希望原始数据是本地的?

  2. When setting up the SAS libraries in enterprise guide is there a way to create sub libraries so I can construct in the same way as SQL server management studio? 在企业指南中设置SAS库时,是否可以创建子库,以便以与SQL Server Management Studio相同的方式进行构造? For example... 例如...

    • Server 服务器
      • Database 数据库
        • Table

I can create the tables from each database in one library but due to the size of the SQL server it will mean allot of libraries and also make them difficult to name due to the lib name length restrictions in SAS 我可以在一个库中从每个数据库中创建表,但是由于SQL Server的大小,这将意味着分配库,并且由于SAS中的库名长度限制而使它们难以命名

  1. Finally is there a way to specify multiple schema names so different schema names can reside under one library? 最后,是否有一种方法可以指定多个模式名称,以便不同的模式名称可以驻留在一个库中?

Eg dbo.table1 & test.table1 (Where they are the same table name but different tables due to the schema name?) 例如dbo.table1&test.table1(哪里是相同的表名,但由于架构名而不同的表?)

I really hope someone can help! 我真的希望有人能提供帮助! I appreciate this maybe a big question. 我很欣赏这可能是个大问题。 I have done a good deal of searching around the internet and on stack overflow and could not find an answer. 我已经在互联网上进行了大量搜索,并且在堆栈溢出时也找不到答案。

Many many thanks in advance! 在此先谢谢了!

I'll answer part of your question. 我会回答您的部分问题。

  1. No, the data is still on the server, even though it shows as local. 不,即使数据显示为本地,数据仍在服务器上。
  2. No, Only single level libraries are supported. 否,仅支持单级库。

  3. I'm not 100% sure on this, I know you can assign multiple libraries with paths, so you could try adding in multiple definitions and see if that works, or some variant with the libname function (not statement). 我对此不太确定,我知道您可以为多个库分配路径,因此您可以尝试添加多个定义,看看是否可行,或者使用libname函数的某些变体(不是语句)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM