Home > database >  SQL query, from string converting date and/or time, conversion failure.
SQL query, from string converting date and/or time, conversion failure.

Time:11-17

 

SELECT count (*) as number [return] FROM [information table] WHERE [creation time] & gt;=cast (' June 8, 2020 'as a datetime)
Error: from a string when converting date and/or time, conversion fails,

SELECT count (*) as number [return] FROM [information table] WHERE [creation time] & gt;=the CONVERT (varchar, June 8, 2020, 111)
This is not correct results,,,

Because of my content may be on June 8, 2020 May also be 2020/6/8, everybody what method general transformation no, I don't just turn on June 8, 2020 to also go this


CodePudding user response:

The replace once, the year and month replaced with a minus sign, day replace Spaces, and transformation

CodePudding user response:

Can the first incoming parameters (probably on June 8, 2020, may also be 2020/6/8) as the image preprocessing. And then joining together into the SQL execution.

CodePudding user response: