This example uses the
alias DBCON for the DBMS connection (the connection alias is optional):
proc sql;
connect to mysql as dbcon
(user=testuser password=testpass server=mysqlserv
database=mysqldb port=9876);
quit;
This example connects
to MySQL and sends it two EXECUTE statements to process:
proc sql;
connect to mysql (user=testuser password=testpass server=mysqlserv
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 testuser) 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=testuser password=testpass server=mysqlserv
database=mysqldb port=9876);
select *
from connection to mysql
(select * from customers
where customer like '1%');
disconnect from mysql;
quit;