BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.

what is the way to see column names and their type(character or numeric) when using Teradata passthrough.


PROC SQL;
CONNECT TO TERADATA(USER="new_sas_user_4" PASSWORD="xxxx" );
create table a as select * from connection to teradata(
proc contents data= database_name.table_name

);
disconnect from teradata;
quit;

this is not working 😕

1 ACCEPTED SOLUTION

Accepted Solutions
new_sas_user_4
Quartz | Level 8

I was able to see a sample of the rows from the teradata table using the below code....explicit passthrough.

PROC SQL;
CONNECT TO TERADATA(USER="username" PASSWORD="password" );
create table A2 as select * from connection to teradata(
SELECT
* from terdata_database.table_name sample 10

);
disconnect from teradata;
quit;

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

That is a question for Teradata forum.  All of the code inside the () after the FROM CONNECTION TO xxx needs to be valid syntax for the foreign database.

https://stackoverflow.com/questions/49013777/how-to-list-the-columns-of-a-table-in-teradata-sql

 

Basically run a query against the metadata view 

dbc.columnsV

 

 

Ksharp
Super User

Here is an example for ODBC. But the same thing should be done for TD.

Also you could try SQLColumns(,"dbo")

/*
https://www.connectionstrings.com/
https://www.connectionstrings.com/microsoft-odbc-driver-13-for-sql-server/
https://communities.sas.com/t5/Administration-and-Deployment/Tables-not-shown-up/m-p/939847#M28853
*/


proc sql;
connect to odbc as MyODBCName (dsn="MyODBCName" user="username" password="password");
select * from connection to MyODBCName (
ODBC::SQLTables(,"dbo")
)
;
disconnect from MyODBCName ;
quit;
Patrick
Opal | Level 21

what is the way to see column names and their type(character or numeric) when using Teradata passthrough.

Do you want to see the Teradata data types or to what they map on the SAS side?
If it's just on the SAS side (character or numeric) then use a libname and then Proc Contents.

libname mytera teradata <connection info>.
proc contents data=mytera.<table name>;
run;

If you want the actual Teradata data types then using SAS it must be via explicit SQL passthrough using Teradata specific syntax - for which you would need to ask in a Teradata forum.

new_sas_user_4
Quartz | Level 8

I was able to see a sample of the rows from the teradata table using the below code....explicit passthrough.

PROC SQL;
CONNECT TO TERADATA(USER="username" PASSWORD="password" );
create table A2 as select * from connection to teradata(
SELECT
* from terdata_database.table_name sample 10

);
disconnect from teradata;
quit;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1109 views
  • 0 likes
  • 4 in conversation