Hi, 
are you still getting that error?? It sounds weird

 
 

2017-06-12 14:22 GMT-03:00 Ariel Abadi <aabadi@starconnecting.com>:
Hi!

May be someone can help me, Im facing the following problem.
Im trying to pull some information from the field nrm_connect_time, I tried almost all the date/timestamp functions, but all of them failed.

Finally, I decided to CAST as STRING, and see what happends...

If I do a SELECT DISTINCT .. then I have the correct information, if I dont include the DISTINCT what I see has nonsense...

sql>SELECT nrm_connect_time, LEFT(CAST(nrm_connect_time AS STRING),10) FROM NRM_20170609 LIMIT 5;
+----------------------+-----------------------+
| nrm_connect_time     | left_nrm_connect_time |
+======================+=======================+
| 2017-06-09 00:05:00  | -1-01-01 0            |
| 2017-06-09 00:05:00  | -1-01-01 0            |
| 2017-06-09 00:05:01  | -1-01-01 0            |
| 2017-06-09 00:05:03  | -1-01-01 0            |
| 2017-06-09 00:05:03  | -1-01-01 0            |
+----------------------+-----------------------+
5 tuples (29.802ms)
sql>SELECT DISTINCT nrm_connect_time, LEFT(CAST(nrm_connect_time AS STRING),10) FROM NRM_20170609 LIMIT 5;
+----------------------+------------+
| nrm_connect_time     | L2         |
+======================+============+
| 2017-06-09 00:05:00  | 2017-06-09 |
| 2017-06-09 00:05:01  | 2017-06-09 |
| 2017-06-09 00:05:03  | 2017-06-09 |
| 2017-06-09 00:05:04  | 2017-06-09 |
| 2017-06-09 00:05:05  | 2017-06-09 |
+----------------------+------------+
5 tuples (424.306ms)

The "nrm_connect_time"  is defined as TIMESTAMP(0).


Let me show you a differente example:

sql>SELECT DISTINCT nrm_connect_time, LEFT(CAST(nrm_connect_time AS STRING),10), timestamp_to_str(nrm_connect_time, '%Y') FROM NRM_20170609 LIMIT 5;
+----------------------+------------+------+
| nrm_connect_time     | L2         | L3   |
+======================+============+======+
| 2017-06-09 00:05:00  | 2017-06-09 | 2017 |
| 2017-06-09 00:05:01  | 2017-06-09 | 2017 |
| 2017-06-09 00:05:03  | 2017-06-09 | 2017 |
| 2017-06-09 00:05:04  | 2017-06-09 | 2017 |
| 2017-06-09 00:05:05  | 2017-06-09 | 2017 |
+----------------------+------------+------+
5 tuples (707.217ms)

sql>SELECT  nrm_connect_time, LEFT(CAST(nrm_connect_time AS STRING),10), timestamp_to_str(nrm_connect_time, '%Y') FROM NRM_20170609 LIMIT 5;

TypeException:user.s16_55[123]:'mtime.timestamp_to_str' undefined in:     mtime.timestamp_to_str(X_196:oid,A1:str);
program contains errors


Regards
Ariel


_______________________________________________
users-list mailing list
users-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/users-list