BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jade_SAS
Pyrite | Level 9

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

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

You should be able to prefix your server, database and schema to your stored procedure:

 

EXECUTE (MySQLServer.MyDatabase.HT.pLoadtest) by SQLSVR;

View solution in original post

3 REPLIES 3
Reeza
Super User

Have you checked that you're connecting to the daabase properly? Ie does a select work before trying to run a stored proc. 

SASKiwi
PROC Star

You should be able to prefix your server, database and schema to your stored procedure:

 

EXECUTE (MySQLServer.MyDatabase.HT.pLoadtest) by SQLSVR;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 3 replies
  • 2978 views
  • 0 likes
  • 3 in conversation