Hi All,
I used to run the stored SQL procedure via the following code, everything works:
PROC SQL;
CONNECT TO SQLSVR (dsn="SQL_Database_name" uid="***" pwd="***") ;
EXECUTE (HT.pLoadtest) by SQLSVR;
Quit;
Recently the SAS admin re-defined the dsn on the SAS server, current dsn is defined at SQL server level, the previous dsn (that at SQL database level) does not exist any more.
I know we can add "Qualifier" in the Libname statement when the DATASRC is defined at SQL_Server level (See details below).
LIBNAME test SQLSVR DATASRC="SQL_Server_name" Qualifier=SQL_Database_name schema=HT user="***" password="***";
But I don't know what we should add the to PROC SQL pass throught process to get the stored SQL procedure (at HT schema)work. I tried the following coding and got an error, the error said "could not find stored procedureHT.ploadtest.....
PROC SQL;
CONNECT TO SQLSVR (dsn="SQL_Server_name" uid="***" pwd="***") ;
EXECUTE (HT.pLoadtest) by SQLSVR;
Quit;
Is there anything we can do to make the above coding work? Or the DSN has be be defined at the database level for the EXECUTE stored SQL procedure purpose?
Thank you so much!!!
Thanks,
Jade
You should be able to prefix your server, database and schema to your stored procedure:
EXECUTE (MySQLServer.MyDatabase.HT.pLoadtest) by SQLSVR;
Have you checked that you're connecting to the daabase properly? Ie does a select work before trying to run a stored proc.
You should be able to prefix your server, database and schema to your stored procedure:
EXECUTE (MySQLServer.MyDatabase.HT.pLoadtest) by SQLSVR;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.