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

No function mapping for datetime.Ticks in sqlserver #35436

Open
z505985755 opened this issue Jan 8, 2025 · 8 comments
Open

No function mapping for datetime.Ticks in sqlserver #35436

z505985755 opened this issue Jan 8, 2025 · 8 comments

Comments

@z505985755
Copy link

Although it can be implemented through other functions or client evaluation, they all have their own disadvantages.

@cincuranet
Copy link
Contributor

What are you suggesting?

@z505985755
Copy link
Author

z505985755 commented Jan 9, 2025

What are you suggesting?

I suggest that try to keep the function mappings of different databases consistent, increase their intersections as much as possible, and reduce their differences. Since the function mapping of datetime.Ticks can be implemented in SQL Server, why not do it? (Function mapping for datetime.Ticks implemented in sqlite)

@cincuranet
Copy link
Contributor

Sure. Are you going to submit PR?

@z505985755
Copy link
Author

Sure. Are you going to submit PR?

I have never submitted a PR, can I try?

@cincuranet
Copy link
Contributor

I have never submitted a PR, can I try?

Absolutely! We'll help you to get it across finish line.

@z505985755
Copy link
Author

z505985755 commented Jan 10, 2025

I have never submitted a PR, can I try?

Absolutely! We'll help you to get it across finish line.

I want to use the sqlserver's datediff_big function to calculate the microsecond difference from 0001-01-01 00:00:00.0 and then multiply it by 10. Is this feasible?

@cincuranet
Copy link
Contributor

That function is not available before SQL Server 2016 (13.x) and Azure Synapse. Hence, if possible, I would like to try different path.

@z505985755
Copy link
Author

I think I can use datediff to get the minute difference of 0001-01-01 00:00:00.0, then multiply it by a value, and then get the ticks of seconds, milliseconds, microseconds, and nanoseconds respectively, and finally add them up.

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

No branches or pull requests

2 participants