Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

teradata SQL sequence generation - forum topic by murali901@gmail.com

$
0
0

Hi Folks,
I would like to insert records into the Reference table(xref_subject_area) from stage table(detail_stg) in sequence order, when do not have records in reference table where as present in the stage table. please find below is table structures:
CREATE SET TABLE MYDB.detail_stg ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT,
DEFAULT MERGEBLOCKRATIO
(
subject_area_Nm VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
version_no varchar(10) CHARACTER SET LATIN NOT CASESPECIFIC,
mapping_nm varchar(256) CHARACTER SET LATIN NOT CASESPECIFIC
PRIMARY INDEX ( mapping_nm );
insert into MYDB.detail_stg values('ACES','V1.1','EPDS_SYS');
insert into MYDB.detail_stg values('CS90','V1.1','EPDS2_SYS');
insert into MYDB.detail_stg values('ACBS','V1.0','WGS_SYS');
insert into MYDB.detail_stg values('NASCO','V1.1','NASCO_SYS');
insert into MYDB.detail_stg values('WMS','V1.1','EPDS1_SYS');
insert into MYDB.detail_stg values('NMS','V1.1','WGS_NMS_SYS');
 
Ref table:
 
CREATE SET TABLE MYDB.xref_subject_area ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT,
DEFAULT MERGEBLOCKRATIO
(
subject_area_Id INTEGER NOT NULL,
subject_area_Nm VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
subject_area_Desc VARCHAR(2000) CHARACTER SET LATIN NOT CASESPECIFIC)
PRIMARY INDEX ( subject_area_Id );
 
insert into MYDB.xref_subject_area values(1,'ACES','ACES Desc');
insert into MYDB.xref_subject_area values(2,'CS90','CS90 Desc');
insert into MYDB.xref_subject_area values(3,'ACBS','ACBS Desc');
insert into MYDB.xref_subject_area values(4,'membership','membership Desc');
insert into MYDB.xref_subject_area values(5,'Provider','provider Desc');
 
Output would be in xref_subject_area table:
1,'ACES','ACES Desc'
2,'CS90','CS90 Desc'
3,'ACBS','ACBS Desc'
4,'membership','membership Desc'
5,'Provider','Provider Desc'
6,'NASCO','NASCO Desc'
7,'WMS','WMS Desc'
8,'NMS','NMS Desc'
 
thanks for your help.
 
Regards,
Murali.
 
 

Forums: 

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>