cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Current_Timestamp to HANA table

Former Member
0 Kudos

Hi,

We have tables that are replicated from SAP using SLT.

 

We are trying to add a column to that table, so we can capture insert/update datetime every time a record is inserted or updated in the table.

We have two options currently:

1. We can add the physically add the column to the table and use the transformation from SLT server to update/insert the date with current_timestamp.

2. Adding trigger to the tables - We were told by SAP that this was not a good practice for replicated tables.

Instead of configuring in SLT server, we are trying to see if we can do this using virtual column like "Alter Table xxx Generate Always As
current_timestamp).


Apparently we cannot use Current_Timestamp in Generated As columns.

 

My question is does anyone know any work around where we can assign current_timestamp to virtual columns?

Or is there any way I can accomplish this other than using virtual columns?

I cannot use default in a column as it needs to update for both insert and update.


Thank you for your help.

Hyun

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Hyun,

We are having the same scenario to get current_timestamp as virtual column in a table in HANA. Were you able to get through with any workarounds?

Please share your comments.

Thanks,

Remya

Former Member
0 Kudos

Hi Remya,

Unfortunately we did not find the workaround in virtual/generated column.

The way we made it work was to configure SLT process to add a physical
column to a target table and created the transformation in SLT to populate the
column.  I hope this helps.

Thanks,

Hyun

Former Member
0 Kudos

Hi Hyun,

Thanks for your comments.

But in the case of SLT, does the virtual column always hold today's date? Or the date as on record creation/updation time?

Thanks,

Remya

lbreddemann
Active Contributor
0 Kudos

Guys,

what is the use case here?

Why is it even relevant to know the server time when a record had been inserted by SLT?

Be very clear about that this is not an application level timestamp.

It doesn't tell you when the record was changed in the application nor when it was valid for the application.

So, what is behind the mysterious scenario to have a column that is automagically filled with the DB server timestamp of when a record is gets inserted/updated in a table?

- Lars

Former Member
0 Kudos

Hi Lars,

Sharing you the details on my requirement.

We are trying to mark the current date, current week, current fiscal week in the time dimension table. The first 2 scenarios can be handled using the expression in HANA, but not fiscal week.

If I can get today's date as a virtual column in Time Dimension, I will use this to join to another instance of Time Dimension to get the current fiscal week.

Please share your thoughts.

Thanks,
Remya

aravindmail0295
Explorer
0 Kudos

I have a similar scenario as In my requirement is....

Through a procedure , we are extracting data from view to a reporting table through a field called LAST_CHANGED ( updates the last changed timestamp in the base tables )

Now when are tables are getting replicated through SLT , we expect a latency delay

ie: if a table is getting changed at 3:00 pm at the source , my view (target) gets the data at 3.30 pm. So in order to deal with this we are planning to have a current timestamp filed in the View so that my procedure get extract the delta records based upon the current time stamp field.

need suggestions on how to handle this situation apart from using DB triggers.

Thanks for your help.

Regards

Aravind.