Search code examples
sqlsql-timestamp

sql query using timestamp returns nothing


I have a SQL table with a column create_date of type timestamp. I want to perform a query on the table that looks like this:

select * 
from table 
where create_date = '2022-11-17 13:42:42.309'

This should return the row with id=6. But when I execute this query it returns 0 results.

I tried casting the string to timestamp but that also doesn't work. I also tried adding the '+0000' to the string but that also does nothing.

This is what the table looks like:

enter image description here


Solution

  • found the solution,the miliseconds i received had 6 digits, but the value stored in the server is 3 digits. so by removing the miliseconds the problem was solved