I am trying to extract some data from Teradata but before executing code I would like to test server connection.
I want to execute code only when server is up.
Is there any SAS statement/function that can be used to test server connection in batch mode.
How are you connecting to the server?
The LIBNAME statement will set the macro varaible SYSLIBRC which you can then check.
libname td teradata ..... ;
%if (&syslibrc) %then %do;
%put ERROR: Could not connect to Teradata ;
%end;
%else %do;
... run extract code ...
%end;
How are you connecting to the server?
The LIBNAME statement will set the macro varaible SYSLIBRC which you can then check.
libname td teradata ..... ;
%if (&syslibrc) %then %do;
%put ERROR: Could not connect to Teradata ;
%end;
%else %do;
... run extract code ...
%end;
PROC SQL;
CONNECT TO TERADATA(DATABASE=<dbname> USER=<user> PASSWORD=<pwd>);
CREATE TABLE temp AS
SELECT * FROM CONNECTION TO TERADATA
(SELECT * from <table_name>
sample 0
) ;
DISCONNECT FROM TERADATA;
QUIT;
Try this if you are using SQL Pass through to teradata
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.