SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to run stored SQL procedure at SAS when DSN is at server level?--Urgent help please!

Accepted Solution Solved
Reply
Regular Contributor
Posts: 171
Accepted Solution

How to run stored SQL procedure at SAS when DSN is at server level?--Urgent help please!

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

 

 

 

 


Accepted Solutions
Solution
‎06-16-2017 01:30 PM
Super User
Posts: 3,260

Re: How to run stored SQL procedure at SAS when DSN is at server level?--Urgent help please!

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


All Replies
Super User
Posts: 19,870

Re: How to run stored SQL procedure at SAS when DSN is at server level?--Urgent help please!

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

Solution
‎06-16-2017 01:30 PM
Super User
Posts: 3,260

Re: How to run stored SQL procedure at SAS when DSN is at server level?--Urgent help please!

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

 

EXECUTE (MySQLServer.MyDatabase.HT.pLoadtest) by SQLSVR;
Regular Contributor
Posts: 171

Re: How to run stored SQL procedure at SAS when DSN is at server level?--Urgent help please!

Thank you!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

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