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

ZeroDate #1

Open
steviecoaster opened this issue Sep 20, 2016 · 3 comments
Open

ZeroDate #1

steviecoaster opened this issue Sep 20, 2016 · 3 comments

Comments

@steviecoaster
Copy link

Hey! I found your awesome MySQL module via this link: https://mcpmag.com/articles/2016/03/02/querying-mysql-databases.aspx

One thing I ran into in my particular instance was the use of Zero Date Time. I had to modify the connection string in MySQL psm1 to include 'Convert Zero Datetime=True;' at the end of the string.

Just wanted to give you a heads up. It's a pretty easy MySQL bug to deal with, but in case you wanted to put that inside your module in some way, I thought I'd give you the heads up that others may find it useful as well.

@ysguy
Copy link

ysguy commented Feb 19, 2020

Can you share the lines you changed in the script, its a pretty long file with a number of broken up query spots. Would save some troubleshooting. I am experiencing similar issues. My specific issue is

argument(s): "Incorrect datetime value: '2/26/2020 5:00:00 AM' for column

Seems that wasnt my issue, i fixed my problem with:
(datetime).ToString('yyyy-MM-dd HH:MM:ss')

But maybe you can post the change anyways?

@fablarosa
Copy link

Just edit C:\Program Files\WindowsPowerShell\Modules\MySQL\MySQL.psm1 so that the connection string is

$connectionString = $connectionString + "default command timeout=$CommandTimeOut; Connection Timeout=$ConnectionTimeOut;Allow User Variables=True;Convert Zero Datetime=True"

@fablarosa
Copy link

Can someone please fix this issue in the source code for the next release?

On the new version I changed line 141 of C:\Program Files\WindowsPowerShell\Modules\MySQL\public\Connect-MySqlServer.ps1 to

$connectionString = $connectionString + "default command timeout=$CommandTimeOut; Connection Timeout=$ConnectionTimeOut;Allow User Variables=True;Convert Zero Datetime=True"

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

3 participants