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

Cannot bind date in string format to SQL server datetime2 field #64

Open
esidebo opened this issue Nov 6, 2019 · 0 comments
Open

Cannot bind date in string format to SQL server datetime2 field #64

esidebo opened this issue Nov 6, 2019 · 0 comments

Comments

@esidebo
Copy link

esidebo commented Nov 6, 2019

I create a statement on the form INSERT INTO table(date) VALUES(?) where date is of type datetime2 in my MSSQL table. When trying to bind to it with a std::string representing the date and time (e.g. like "2019-04-23 22:07:15.000000") I get the following error:

Operand type clash: text is incompatible with datetime2

Is this expected? I have no trouble binding a string to a datetime in mysql, it seems there is something special with datetime2. I can work around by passing the query to the session and encapsulating the datetime string with single quotes, but I would like to use a (prepared) statement since I'm doing this many times in a loop.

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