Creation of 2 records from one.
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Creation of 2 records from one. Expand / Collapse
Author
Message
Posted 5/24/2008 8:27:41 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 5/24/2008 11:15:50 AM
Posts: 1, Visits: 5
Hi all,
I need to create two records out of one, conditionally.
The situation is, i have a single record which contains a date field. I need to create another one with same values for all the fields except this date field. I know how to populate/manipulate the date field but dont know how to create two out of one records.
Please help....


Shuabh
Post #11591
Posted 5/29/2008 8:11:01 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Yesterday @ 2:48:50 PM
Posts: 24, Visits: 80
I may have got the wrong end of the stick but this works!

Good luck.



/* CREATE TEMP TABLE */
create multiset volatile table RT_TEST
(
colA byteint not null
,colB date format 'yyyymmdd' not null
,colC byteint not null
) primary index (colA)
on commit preserve rows;

/* INSERT TEST DATA */
insert into RT_TEST ( 1, 1080528, 10 );
insert into RT_TEST ( 2, 1080529, 20 );
insert into RT_TEST ( 3, 1080530, 30 );

/* SHOW DATA */
sel * from rt_test;

/* - SQL ABOVE RETURNS -
colA colB colC
1 28/05/2008 10
2 29/05/2008 20
3 30/05/2008 30
*/


/* CONDITIONAL INSERT */
INSERT INTO RT_TEST
SELECT
colA
,1081231
,colC
FROM RT_TEST
WHERE colB = 1080529;

/* SHOW DATA */
sel * from RT_TEST;

/* - SQL ABOVE RETURNS -
colA colB colC
1 28/05/2008 10
2 29/05/2008 20
2 31/12/2008 20
3 30/05/2008 30
*/
Post #11666
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 3:55pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.094. 9 queries. Compression Disabled.