SQL Pass-Through Facility Specifics for MySQL

Key Information

For general information about this feature, see SQL Pass-Through Facility.

Here are the SQL pass-through facility specifics for MySQL.

Examples

This example uses the alias DBCON for the DBMS connection (the connection alias is optional):

proc sql;
   connect to mysql as dbcon
       (user=myusr1 password=mypwd1 server=mysrv1
        database=mysqldb port=9876);
quit;

This example connects to MySQL and sends it two EXECUTE statements to process:

proc sql;
   connect to mysql (user=myusr1 password=mypwd1 server=mysrv1
        database=mysqldb port=9876);
   execute (create table whotookorders as
      select ordernum, takenby,
             firstname, lastname, phone
         from orders, employees
         where orders.takenby=employees.empid)
      by mysql;
   execute (grant select on whotookorders
            to myusr1) by mysql;
   disconnect from mysql;
quit;

This example performs a query, shown in highlighted text, on the MySQL table CUSTOMERS:

proc sql;
connect to mysql (user=myusr1 password=mypwd1 server=mysrv1
        database=mysqldb port=9876);
select *
   from connection to mysql
     (select * from customers
      where customer like '1%');
    disconnect from mysql;
quit;
Last updated: February 3, 2026