Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigint being returned as a string #87

Open
richardmh opened this issue Oct 14, 2023 · 1 comment
Open

bigint being returned as a string #87

richardmh opened this issue Oct 14, 2023 · 1 comment

Comments

@richardmh
Copy link

When returning epoch dates out of MSSQL we need to use DATEDIFF function:

in a query, using the T-SQL function DATEDIFF(SECOND,'1970-01-01',getdate()) returns an int and this is correctly returned as a number in the result in node-red.

However, the T-SQL function DATEDIFF_BIG(SECOND,'1970-01-01',getdate()) returns a bigint, and this is being returned as a string in node-red.

Seems completely repeatable.

Of course we can use parseInt() to convert the string to a number, but the above is an inconsistency better fixed internally please.

In the case of epoch dates, this Is of significance:
a) If you want to return a full milliseconds epoch date as in DATEDIFF_BIG(MILLISECOND,'1970-01-01',getdate()) then you have to use DATEDIFF_BIG or you get an overflow.
b) All epoch dates in seconds after 2038-01-19 03:14:07 will be too big for an int data type (a 4 byte integer) so we should become accustomed to using DATEDIFF_BIG in T-SQL to produce epoch dates.

Great node otherwise - thankyou for making it..

Richard

@richardmh
Copy link
Author

Need to add - this is 0.12.1 on node-red 3.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant