Using an SQL timestamp value in an SQL Execute query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2019 11:42 AM
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:
- 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
- The selected value is now assigned to $LastTimestamp and contains ‘Base64 encoded data’ - it actually looks like “AAAAAB6+044AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=”
- 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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2021 02:00 PM
Hello,
I have a similar issue. I wonder if this ever got a response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2023 08:13 AM
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!
