cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Using an SQL timestamp value in an SQL Execute query

dwainwright
New Contributor

I am attempting to select data from an SQL Server database and using a timestamp in the where clause and having some challenges.

I am taking a 2-step process:

  1. Select from a DB table the most recent timestamp. This is a binary(8) data-typed field that contains an actual timestamp value. E.G 0x000000001EBED38E
  2. The selected value is now assigned to $LastTimestamp and contains โ€˜Base64 encoded dataโ€™ - it actually looks like โ€œAAAAAB6+044AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=โ€
  3. Use this timestamp value in an SQL Select statement.

Example, stripped back version of the SQL query is:

SELECT TOP 1000 * FROM MyDB where MyDB.timestamp >= $LastTimestamp

Iโ€™ve tried a few things, such as decoding/encoding all with no success. Often results in a message that looks like:

โ€œUnable to decode base64 value, Reason: Bad Base64 input character decimal 0 in array position 0, Resolution: Make sure the argument is valid base64โ€

Question - how can i use the binary(8) timestamp retrieved in one snap as part of the where clause in another snap?

2 REPLIES 2

ADORAISWAMY
New Contributor II

Hello,
I have a similar issue. I wonder if this ever got a response.

heidi_andrew
Contributor

I continue to have trouble with the sql syntax in Oracle Select and Oracle Execution. I do not see good examples of syntax anywhere. Need dates, need date math. I cannot find it on the documentation that is not Java based. I do not know Java and am using sql against our databases. If anyone has some links, i would appreciate it!