-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 20/10/15 16:51, Robin Cijvat wrote:
Hello everyone! I am facing some (probably simple) problems. A snippet of a timestamp column in my table:
+----------------------------+ | ts | +============================+ | 1595-04-02 00:00:00.000000 | | 1595-04-02 00:00:00.000000 | | 1595-04-02 00:00:00.000000 | | 1595-04-02 00:00:00.000000 | | 1598-03-25 00:00:00.000000 | +----------------------------+
I want to fill all the times in these fields with a random value (uniformly distributed is fine). This faces me with the following problems:
- Adding an interval to a timestamp does not seem to be suited
for dynamic intervals: This works fine: UPDATE "table" SET ts = (ts
- INTERVAL '5000' SECOND); This doesn't: UPDATE "table" SET ts =
(ts + INTERVAL (CAST(5000 AS STRING)) SECOND); Does someone maybe know of a way to accomplish this?
- Does someone know how to normalize the output of the RAND
operator available in SQL? It seems to calculate a random BIGINT, and in order for me to normalize it, I would need the maximum value of a BIGINT, which of course is platform dependent. Is there a way to get the max value of BIGINT on the SQL level? Or can I go about this another way?
All help is much appreciated!
Robin
sql>select cast(5000 as interval second); +----------+ | L1 | +==========+ | 5000.000 | +----------+
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
- -- Sjoerd Mullender