%1! is not a valid style number when converting from datetime to a character string.

%1! is not a valid style number when converting from datetime to a character string.

Error Message:
Msg 281, Level 16, State 1, Line 1
%1! is not a valid style number when converting from datetime to a character string.

Severity level:
16.

Description:
This error message appears when you try to use an invalid style number with the CONVERT() function.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity level 15 are generated by the user and can be fixed by the SQL Server user. In this case you need to specify a valid style number.

Versions:
All versions of SQL Server.

Example(s):
SELECT CONVERT(VARCHAR, GETDATE(), 99)

Remarks:
99 is no valid style number for CONVERT(). The most commonly used ones you can find in the SQL Server Books Online (BOL) in the CAST and CONVERT topic.

]]>

jwokelly

Website:

Leave a Reply

Your email address will not be published. Required fields are marked *