SlideShare ist ein Scribd-Unternehmen logo
1 von 26
SQL Pass-Through and the ODBC Interface: Extract and Transform Your Data FASTER – For PC SAS Users
Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Definitions
Definitions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ODBC Connection Setup
Syntax
ODBC Libname Statement (Implicit) libname CDB ODBC datasrc=db2p user=uid password=yourpwd schema=GWY1; proc   sql ; create table WORK.ACCOUNT as select ACCT_NUM, OPEN_ENRLM_BEG_DT, OPEN_ENRLM_END_DT  FROM CDB.ACCOUNT; quit;
Explicit Pass-Through Syntax ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why Use Explicit Pass-Through?
Processing Location Affects Processing Speed "No one will believe you solved this problem in one day! We've been working on it for months. Now, go act busy for a few weeks and I'll let you know when it's time to tell them."   --submission from a real-life “Dilbert Quotes” contest
Processing Location... Regular Query does processing work in SAS on your PC using SAS functions Pass-Through Query does processing work in RDBMS where the data is stored using “native” Oracle/DB2 functions  Faster!!
...Affects Processing Speed ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Pass-through query: Non pass-through query:
Differences in Numeric Precision – Oracle example
A Mysterious Problem ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Original Query proc sql; create table work.s1_claim_row as select put(claim_uid,best16.)   as claim_uid  length=  16   from prodj.s1_claim  ;  quit;
What Happened? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Solution (SAS/Access Interface to ODBC) proc sql; connect to odbc(datasrc = "PRODJ" user=xxxxxxxxxxx password=xxxxxxxxxxxx); create table work.s1_claim_row as select * from connection to odbc (select  to_char(claim_uid,'0000000000000000')  as claim_uid from onesource_o.s1_claim  ) ; disconnect from odbc; quit;
Solution (SAS/Access Interface to Oracle) proc sql; connect to oracle(path = "prodj.cigna.com" user=xxxxxxx password=xxxxxxx); create table work.s1_claim_row as select * from connection to oracle (select to_char(claim_uid,'0000000000000000') as claim_uid from onesource_o.s1_claim  ) ; disconnect from oracle; quit;
Differences in Naming Conventions – DB2 example
Original Query libname CDB ODBC datasrc=db2p user=uid password=yourpwd schema=GWY1; proc   sql ; create table WORK.ACCOUNT as select ACCT_NUM, OPEN_ENRLM_BEG_DT, OPEN_ENRLM_END_DT  FROM CDB.ACCOUNT; quit;
Log Error ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Problem ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Solution proc   sql ; connect to odbc(datasrc = "db2p" user=uid password=yourpwd);  create table WORK.ACCOUNT as select * from connection to odbc (select ACCT_NUM, OPEN_ENRLM_BEG_DT, OPEN_ENRLM_END_DT  FROM GWY1.ACCOUNT); disconnect from odbc; quit;
Conclusion
Why Use Pass-Through Queries? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Contact Information ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

Sql tutorial-Structured query language
Sql tutorial-Structured query languageSql tutorial-Structured query language
Sql tutorial-Structured query languageMayank Bansal
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaEdureka!
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Beat Signer
 
Oracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesOracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesMarco Gralike
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic ConceptsTony Wong
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)Sabana Maharjan
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionMedhat Dawoud
 
SQL Server Learning Drive
SQL Server Learning Drive SQL Server Learning Drive
SQL Server Learning Drive TechandMate
 
Introduction to SQL, SQL*Plus
Introduction to SQL, SQL*PlusIntroduction to SQL, SQL*Plus
Introduction to SQL, SQL*PlusChhom Karath
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginnersRam Sagar Mourya
 
Oracle Course
Oracle CourseOracle Course
Oracle Courserspaike
 

Was ist angesagt? (20)

Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
 
Sql tutorial-Structured query language
Sql tutorial-Structured query languageSql tutorial-Structured query language
Sql tutorial-Structured query language
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
Sql Basics And Advanced
Sql Basics And AdvancedSql Basics And Advanced
Sql Basics And Advanced
 
Oracle notes
Oracle notesOracle notes
Oracle notes
 
SQL Differences SQL Interview Questions
SQL Differences  SQL Interview QuestionsSQL Differences  SQL Interview Questions
SQL Differences SQL Interview Questions
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | Edureka
 
Using T-SQL
Using T-SQL Using T-SQL
Using T-SQL
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
 
Oracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesOracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New Features
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)
 
Intro to T-SQL – 2nd session
Intro to T-SQL – 2nd sessionIntro to T-SQL – 2nd session
Intro to T-SQL – 2nd session
 
SQL Server Learning Drive
SQL Server Learning Drive SQL Server Learning Drive
SQL Server Learning Drive
 
Introduction to SQL, SQL*Plus
Introduction to SQL, SQL*PlusIntroduction to SQL, SQL*Plus
Introduction to SQL, SQL*Plus
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
 
Oracle Course
Oracle CourseOracle Course
Oracle Course
 

Ähnlich wie SQL Pass Through and the ODBC Interface

SAS Access / SAS Connect
SAS Access / SAS ConnectSAS Access / SAS Connect
SAS Access / SAS Connectguest2160992
 
Designer's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServerDesigner's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServerKaren Lopez
 
SAS Online Training Institute in Hyderabad - C-Point
SAS Online Training Institute in Hyderabad - C-PointSAS Online Training Institute in Hyderabad - C-Point
SAS Online Training Institute in Hyderabad - C-Pointcpointss
 
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...Karen Lopez
 
SQL-Server Database.pdf
SQL-Server Database.pdfSQL-Server Database.pdf
SQL-Server Database.pdfShehryarSH1
 
Data SLA in the public cloud
Data SLA in the public cloudData SLA in the public cloud
Data SLA in the public cloudLiran Zelkha
 
High Performance Jdbc
High Performance JdbcHigh Performance Jdbc
High Performance JdbcSam Pattsin
 
Roles y Responsabilidades en SQL Azure
Roles y Responsabilidades en SQL AzureRoles y Responsabilidades en SQL Azure
Roles y Responsabilidades en SQL AzureEduardo Castro
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desaijmsthakur
 
SPL_ALL_EN.pptx
SPL_ALL_EN.pptxSPL_ALL_EN.pptx
SPL_ALL_EN.pptx政宏 张
 
OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL Suraj Bang
 
Php Data Objects
Php Data ObjectsPhp Data Objects
Php Data Objectshiren.joshi
 

Ähnlich wie SQL Pass Through and the ODBC Interface (20)

SAS Access / SAS Connect
SAS Access / SAS ConnectSAS Access / SAS Connect
SAS Access / SAS Connect
 
Designer's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServerDesigner's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServer
 
SAS Online Training Institute in Hyderabad - C-Point
SAS Online Training Institute in Hyderabad - C-PointSAS Online Training Institute in Hyderabad - C-Point
SAS Online Training Institute in Hyderabad - C-Point
 
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...
 
The RDBMS You Should Be Using
The RDBMS You Should Be UsingThe RDBMS You Should Be Using
The RDBMS You Should Be Using
 
User Group3009
User Group3009User Group3009
User Group3009
 
SQL-Server Database.pdf
SQL-Server Database.pdfSQL-Server Database.pdf
SQL-Server Database.pdf
 
Data SLA in the public cloud
Data SLA in the public cloudData SLA in the public cloud
Data SLA in the public cloud
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Java jdbc
Java jdbcJava jdbc
Java jdbc
 
High Performance Jdbc
High Performance JdbcHigh Performance Jdbc
High Performance Jdbc
 
Jdbc sasidhar
Jdbc  sasidharJdbc  sasidhar
Jdbc sasidhar
 
Roles y Responsabilidades en SQL Azure
Roles y Responsabilidades en SQL AzureRoles y Responsabilidades en SQL Azure
Roles y Responsabilidades en SQL Azure
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desai
 
SPL_ALL_EN.pptx
SPL_ALL_EN.pptxSPL_ALL_EN.pptx
SPL_ALL_EN.pptx
 
Jdbc
JdbcJdbc
Jdbc
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
 
OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL
 
Jdbc drivers
Jdbc driversJdbc drivers
Jdbc drivers
 
Php Data Objects
Php Data ObjectsPhp Data Objects
Php Data Objects
 

SQL Pass Through and the ODBC Interface

  • 1. SQL Pass-Through and the ODBC Interface: Extract and Transform Your Data FASTER – For PC SAS Users
  • 2.
  • 4.
  • 7. ODBC Libname Statement (Implicit) libname CDB ODBC datasrc=db2p user=uid password=yourpwd schema=GWY1; proc sql ; create table WORK.ACCOUNT as select ACCT_NUM, OPEN_ENRLM_BEG_DT, OPEN_ENRLM_END_DT FROM CDB.ACCOUNT; quit;
  • 8.
  • 9. Why Use Explicit Pass-Through?
  • 10. Processing Location Affects Processing Speed "No one will believe you solved this problem in one day! We've been working on it for months. Now, go act busy for a few weeks and I'll let you know when it's time to tell them." --submission from a real-life “Dilbert Quotes” contest
  • 11. Processing Location... Regular Query does processing work in SAS on your PC using SAS functions Pass-Through Query does processing work in RDBMS where the data is stored using “native” Oracle/DB2 functions Faster!!
  • 12.
  • 13. Differences in Numeric Precision – Oracle example
  • 14.
  • 15. Original Query proc sql; create table work.s1_claim_row as select put(claim_uid,best16.) as claim_uid length= 16 from prodj.s1_claim ; quit;
  • 16.
  • 17. Solution (SAS/Access Interface to ODBC) proc sql; connect to odbc(datasrc = "PRODJ" user=xxxxxxxxxxx password=xxxxxxxxxxxx); create table work.s1_claim_row as select * from connection to odbc (select to_char(claim_uid,'0000000000000000') as claim_uid from onesource_o.s1_claim ) ; disconnect from odbc; quit;
  • 18. Solution (SAS/Access Interface to Oracle) proc sql; connect to oracle(path = "prodj.cigna.com" user=xxxxxxx password=xxxxxxx); create table work.s1_claim_row as select * from connection to oracle (select to_char(claim_uid,'0000000000000000') as claim_uid from onesource_o.s1_claim ) ; disconnect from oracle; quit;
  • 19. Differences in Naming Conventions – DB2 example
  • 20. Original Query libname CDB ODBC datasrc=db2p user=uid password=yourpwd schema=GWY1; proc sql ; create table WORK.ACCOUNT as select ACCT_NUM, OPEN_ENRLM_BEG_DT, OPEN_ENRLM_END_DT FROM CDB.ACCOUNT; quit;
  • 21.
  • 22.
  • 23. Solution proc sql ; connect to odbc(datasrc = "db2p" user=uid password=yourpwd); create table WORK.ACCOUNT as select * from connection to odbc (select ACCT_NUM, OPEN_ENRLM_BEG_DT, OPEN_ENRLM_END_DT FROM GWY1.ACCOUNT); disconnect from odbc; quit;
  • 25.
  • 26.

Hinweis der Redaktion

  1. "I saw the code for your computer program yesterday. It looked easy. Its just a bunch of typing. And half of the words were spelt wrong. And don’t get me started on your over-use of colons."         - The Pointy-Haired Boss
  2. Add example logs with times contrasting pass-through query time w non-pass-through? Especially faster for complex joins (i.e. mutiple fields) on large tables b/c rdbms is typically optimized to handle such queries. Non pass through: entire tables brought into SAS, SAS does query, produces results Pass through: avoids large data movement, query is done in the database which is optimized to handle the queries, and only results are returned to SAS The more tables being referenced and the larger the tables, the greater the difference in speed.
  3. Add example logs with times contrasting pass-through query time w non-pass-through? Especially faster for complex joins (i.e. mutiple fields) on large tables b/c rdbms is typically optimized to handle such queries. Non pass through: entire tables brought into SAS, SAS does query, produces results Pass through: avoids large data movement, query is done in the database which is optimized to handle the queries, and only results are returned to SAS The more tables being referenced and the larger the tables, the greater the difference in speed.
  4. Or Using Libname clause: proc sql; create table work.s1_claim_row as select * from prodj.s1_claim using libname prodj oracle user=xxxxxxxx password=xxxxxxx path=‘prodj.cigna.com'; quit; Another example of explicit pass-through. Also try using proc sql options _method and _tree to show order of joins and which parts of the query were processed through/passed to the rdbms. Good when trying to join several tables in a database with a sas dataset.
  5. Add non-odbc pass-through syntax for db2?
  6. Or maybe you’re more fluent in another dialect of SQL