Fix MySQL Warning 1287: ‘BINARY expr’ is deprecated and will be removed in a future release

If you get warning number 1287 that reads ‘BINARY expr’ is deprecated and will be removed in a future release. Please use CAST instead when running a query in MySQL, it’s because you’re using the BINARY operator.

The BINARY operator is deprecated as of MySQL 8.0.27.

To fix the issue, cast the value to binary using the CAST() function instead.

Continue reading

Fix Msg 241 “Conversion failed when converting date and/or time from character string” in SQL Server

If you’re getting SQL Server error Msg 241 that reads Conversion failed when converting date and/or time from character string, it’s probably because you’re trying to convert a string to a date/time value, but that particular string can’t be converted to the date/time type specified.

Continue reading

Add the Ordinal Indicator to a Date in Oracle

In Oracle Database, we can use the TH format element to add the ordinal number suffix to the result of a TO_CHAR() operation when formatting dates.

For example, instead of outputting 10 Feb we could output 10th Feb. Or, instead of outputting 21 century, we can output 21st century. The same applies for spelled date components. For example, instead of Twenty One, we can output Twenty First.

Continue reading