Teradata equivallent code to store value to variable

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
New Member

Teradata equivallent code to store value to variable

I want the teradata equivallent code for the following:

 

Select count(*) into: x from dbo.table_name;

 

I am using teradata passthrough from SAS Code. While I am trying to do this it shows error into clause is not allowed.

 

Can anybody help?

 

The complete code is:

 

proc sql;

connect to teradata sa tera ( user= xx password=xx server=xx schema=xx);

execute(select count (distinct ( col (casespecific))) into : var

                        from dbo.tab

                        where col is not null)

by tera;

execute(commit) by tera;

disconnect from tera;

quit;

1 REPLY
Highlighted
Teradata Employee

Re: Teradata equivallent code to store value to variable

So you are converting from Microsoft T-SQL to SAS? Is "var" a SAS variable? Then this is a SAS question and not a database question.

 

The "execute" statement doesn't allow returning any data; use the "from connection to" component of PROC SQL instead, e.g.

 

select var from connection to tera (select count (distinct ( col (casespecific)))

                        from db.tab

                        where col is not null);