Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sequence number using bteq

Status
Not open for further replies.

bteq

Programmer
Jan 4, 2001
4
US
Can you generate a sequence number using bteq? I know you can with other databases such as oracle.
 
I'm not sure if this is what you are refering to but you can create an incrementing column in Teradata SQL if you are running V2R3 or higher.

This is possible using the CSUM function:-

Select '1' as sequence
,CSUM(sequence,??column??)
From Target_table
group by 1
;

??column?? can be practically any column from the target table.

If you use this SQL as a derived table you can then drop the
'sequence' column and use the CSUM column as your sequence number.
 
Each bteq logon establishes a unique session number from that logicalhostid, ie. MVS, ntwk, whatever, which can be tracked in DBC.logonoff, PMON and other means. I don't know that this is what you meant, but I thought I would offer it. Keith
 
Can you generate a substring 'YYYYMM'using bteq?

like :

SUBSTRING ( EXTRACT ( YEAR from DATE) || EXTRACT ( MONTH from DATE 1 for 6 )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top