Resolving SQL Server Exception: Conversion of Varchar Data Type to Datetime Data Type Resulted in an Out-of-Range Value
When working with SQL Server, you may encounter an exception that states: “Unable to retrieve schema. Reason: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.” This error typically occurs when there is a mismatch in the date format. For instance, if you have used the DD/MM/YYYY format for a parameter and the SQL Server is set to the MM/DD/YYYY format.
Solutions
Here are a few solutions to overcome this problem:
-
Change the Dashboard Parameter Format: Modify the dashboard parameter format to MM/DD/YYYY or YYYY/MM/DD. This should align with the SQL Server’s date format.
-
Ensure Consistency in Date Formats: Make sure the SQL Server database date format is the same as the system date format and parameter date format. If they are not the same, you can modify them using specific SQL commands.