prisma / tiberius

TDS 7.2+ (Microsoft SQL Server) driver for Rust
Apache License 2.0
321 stars 118 forks source link

Cannot query with a date between condition. #264

Closed bgalvao closed 1 year ago

bgalvao commented 1 year ago

I'm not sure if this is the right place to ask. I am using connectorx which uses this package.

I am trying to run a select query from python:

SELECT * FROM table
WHERE date_column
BETWEEN '2022-07-01' AND '2022-07-31'

I am using single-quotes on those dates. This results in the error

[2022-12-15T13:35:40Z ERROR tiberius::tds::stream::token] Conversion failed when converting the varchar value '2022-07-01' to data type int. code=245

Is there a way to pass those dates in a way to make the query work with tiberius?

fopsdev commented 1 year ago

hi there, maybe the Answer of: https://stackoverflow.com/questions/65841023/sql-between-date-range-on-string-date can help you.

bgalvao commented 1 year ago

nevermind this, it was definitely a mistake I was doing out of exhaustion - I was specifying a wrong column. Sorry to bother!