Fix Error 9809 “The style … is not supported for conversions from … to …” in SQL Server

If you’re getting error msg 9809 which reads something like The style … is not supported for conversions from … to … in SQL Server, it’s probably because you’re trying to convert between data types, but the style that you’re specifying isn’t supported for that operation.

It’s not that the conversion can’t happen, it’s just that the style that you’re providing is wrong.

This can happen when using the CONVERT() function with the optional style argument. Passing an invalid style number will cause this error.

To fix this issue, make sure you use a valid style when performing the conversion.

Example of Error

Here’s an example of code that results in the error:

SELECT CONVERT( date, '20/01/2035', 199 );

Result:

Msg 9809, Level 16, State 1, Line 1
The style 199 is not supported for conversions from varchar to date.

This error occurred because I used an invalid number for the style argument when converting the value. The style argument is the third argument.

Solution

To fix this error, pass a valid style number.

Example:

SELECT CONVERT( date, '20/01/2035', 103 );

Result:

2035-01-20

This time I passed a valid style argument. Passing a style of 103 means that the date I provided is formatted using the British/French format.

Valid styles: