Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8800

Method for Temporal Data Storage in SAP IQ

$
0
0

If you have an application where you need to track the changing values of information over time and want to be able to see what a snapshot of the information looked like at any point in time, you can use the following method in SAP IQ:

 

  • All tables have an effective_date and end_date column added
  • Data in an existing row is never updated!
  • When data needs to be updated or changed,  you insert a new row with the changed data and a new effective_date and an end_date of '9999-12-31'
  • All pre-existing data is then flagged with an end_date.  Having both an effective_date and end_date marks the row as being a previous version or previous value for a row
  • An end_date of 9999-12-31 marks the row as the newest piece of data

 

The methodology above allows you to write queries and reports that look at data where the "as of" date is between effective_date and end_date.

 

 

For example, if you had the following data:

 

KeyValueeffective_dateend_date
key1xx2010-01-012010-01-01
key1xx2010-01-019999-12-31

 

 

So, when searching for the Key + Value pair, you would run this type of query:

 

 

Select * from my_table where '2009-01-01' between effective_date and end_date

 

 

This would return the first row of data since 2009-01-01 sits between the effective_date and end_date for that row

 

 

 


Viewing all articles
Browse latest Browse all 8800

Trending Articles



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