How to declare a variable and use it ?

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.
Fan

How to declare a variable and use it ?

Hi, I m new to Teradata could anyone pls help how to decalre variable and assign the value from table.My MS SQL Statement is 

 

Declare @Test int;

Set @test = 100 

or 

select @test = count(1) from table 

 

when do the same here in teradata I m getting error. 

 

Thanks in advance

Naga.


Accepted Solutions
Highlighted
Ambassador

Re: How to declare a variable and use it ?

Teradata allows statements like this only within Stored Procedures, there it would be

Declare Test int;
Set test = 100;

select count(1) into test from table 

 

1 ACCEPTED SOLUTION
1 REPLY 1
Highlighted
Ambassador

Re: How to declare a variable and use it ?

Teradata allows statements like this only within Stored Procedures, there it would be

Declare Test int;
Set test = 100;

select count(1) into test from table