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

Temporal usage classic scenerio - forum topic by Qamar.Shahbaz

$
0
0

Hi
I need to track history of party addresses and created a temporal table for this.
CREATE MULTISET TABLE Employee_Addr_Hist (
Name varchar(100),
City varchar (100),
VT PERIOD(DATE) NOT NULL 
)
PRIMARY INDEX(name);
insert into Employee_Addr_Hist (name,city, Validity) values ( 'John','London' ,period( date '2011-01-01', until_changed) );
Now today(2013-03-19) I received a new row from source saying 'John' moved to 'Paris' on '2012-01-01'.
If I use below Update, CURRENT_DATE is used to close previous record and open new. Which is wrong as John moved to Paris on 2012-01-01.
update Employee_Addr_Hist
set  City = 'Paris'
where name = 'John'
and end(VT)  is until_changed
Can anyone help me in this? I just need to use source date for closing old record and opening new using Temporal features.
 
 
 

Tags: 
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>