There is too much precision in the varchar to be converted into datetime.

One option(better in my opinion) would be to change the target column to datetime2(7). Then you can convert like this:

declare @dt varchar(50)
set @dt = '2015-12-02 20:40:37.8130000'

select cast(@dt as datetime2(7));

If changing the column is not an option the you can do the conversion like this:

declare @dt varchar(50)
set @dt = '2015-12-02 20:40:37.8130000'

select cast(cast(@dt as datetime2(7))as datetime)
Answer from Bob Klimes on Stack Exchange
🌐
TablePlus
tableplus.com › blog › 2019 › 09 › convert-varchar-to-date-sql.html
How to convert varchar to date in SQL Server? | TablePlus
September 10, 2019 - To convert a varchar string value to a datetime value using the CONVERT function in SQL Server, here is the general syntax:
Discussions

Convert varchar into datetime in SQL Server - Stack Overflow
If your target column is datetime ... it, SQL will do it for you. ... Should do it. ... But that's not the format the OP has. The OP is stuck with converting mmddyyyy to a datetime. 2020-06-07T03:35:51.667Z+00:00 ... I'd use STUFF to insert dividing chars and then use CONVERT with the appropriate style. Something like this: DECLARE @dt VARCHAR(100)='111290'; ... More on stackoverflow.com
🌐 stackoverflow.com
SQL | Convert varchar to date in WHERE clause
Good day, My date format in Database is in varchar, and I need to get a range of order data from 1st April 2022 to 3rd March 2023. The column name is called date The date records are written like this in varchar: "28-12-2022" I understand to get a range of date, I need to convert varchar to ... More on forums.sqlteam.com
🌐 forums.sqlteam.com
0
May 15, 2023
SQL - Convert nvarchar to datetime "MM/DD/YYYY" format
I need to select from the table but need the date in MM/DD/YYYY format. I tried using CONVERT(VARCHAR, date, 101) but it is still leaving values as DD/MM/YYYY. I also tried to convert as date first before converting to the 101 code but receive an error - The conversion of a nvarchar data type to a datetime ... More on experts-exchange.com
🌐 experts-exchange.com
September 13, 2017
Converting varchar to datetime – SQLServerCentral Forums
Converting varchar to datetime Forum – Learn more on SQLServerCentral More on sqlservercentral.com
🌐 sqlservercentral.com
March 14, 2012
🌐
Reddit
reddit.com › r/sql › converting varchar to datetime
r/SQL on Reddit: Converting varchar to DATETIME
May 10, 2021 -

Hi guys, SQL novice here - I was hoping for a little help. I have this Pivot table query from SQhint which is exactly what I need . Unfortunately, my column for the date source is varchar type and not date time, however the data is formatted as YYYYMMDD (eg. 20200120). Google says I can use CASE or CONVERT but I am not sure exactly how to implement it with this query. Any help is greatly appreciated.

https://sqlhints.com/tag/sql-group-by-month-and-year/

SELECT *
FROM (SELECT YEAR(SalesDate) [Year], 
       DATENAME(MONTH, SalesDate) [Month], 
       COUNT(1) [Sales Count]
      FROM #Sales
      GROUP BY YEAR(SalesDate), 
      DATENAME(MONTH, SalesDate)) AS MontlySalesData
PIVOT( SUM([Sales Count])   
    FOR Month IN ([January],[February],[March],[April],[May],
    [June],[July],[August],[September],[October],[November],
    [December])) AS MNamePivot
🌐
SQLTeam
forums.sqlteam.com › other sql server topics
SQL | Convert varchar to date in WHERE clause - Other SQL Server Topics - SQLTeam.com Forums
May 15, 2023 - Good day, My date format in Database is in varchar, and I need to get a range of order data from 1st April 2022 to 3rd March 2023. The column name is called date The date records are written like this in varchar: "28-1…
🌐
Datameer
datameer.com › home › blog › how to convert datetime value to varchar value in sql server
How to convert DATETIME value to VARCHAR value in SQL Server - Datameer
November 8, 2023 - DECLARE @datetime DATETIME = '2020-10-23 11:21:44.887' -- Convert date into mm/dd/yy SELECT CONVERT(VARCHAR, @datetime, 1) [Date] -- Output Date --------- 10/23/20 -- Convert date into dd/mm/yy SELECT CONVERT(VARCHAR, @datetime, 3) [Date] -- ...
🌐
IBM
community.ibm.com › community › user › discussion › framework-manager-convert-varchar-to-datetime-sql-server
Framework Manager - Convert Varchar to Datetime (SQL SERVER) | Cognos Analytics
Hello all,Cognos version 11.1.6Database: SQLSERVER 2016What is the correct function in Cognos to use to convert a varchar to a datetime (I need the date and the
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › sql server › how-to-convert-datetime-to-varchar-in-sql-server
How to Convert DateTime to VarChar in SQL Server - GeeksforGeeks
July 23, 2025 - In SQL Server, date and time values are often stored in the DATETIME or DATE data types. However, there are situations where we may want to convert these values into a different format such as VARCHAR to display the date in a specific format or for further manipulation.
🌐
BoldBI
support.boldbi.com › kb › article › 13055 › resolving-sql-server-exception-conversion-of-varchar-data-type-to-datetime-data-type-resulted-in-an-out-of-range-value
Resolving SQL Server Exception: Conversion of Varchar Data Type to Datetime Data Type Resulted in an Out-of-Range Value
October 16, 2023 - 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.
🌐
Experts Exchange
experts-exchange.com › questions › 29056419 › SQL-Convert-nvarchar-to-datetime-MM-DD-YYYY-format.html
Solved: SQL - Convert nvarchar to datetime "MM/DD/YYYY" format | Experts Exchange
September 13, 2017 - >I tried using CONVERT(VARCHAR, date, 101) but it is still leaving values as DD/MM/YYYY. Since you've already solved the problem, or at least that should have been the solution, give us a data mockup of the values in your table.
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › converting-varchar-to-datetime-4 › page › 2
Converting varchar to datetime – SQLServerCentral Forums
March 14, 2012 - DECLARE @Table TABLE ( DatetimeasVC VARCHAR(30) ); INSERT @Table · SELECT '10/28/2011 11:47:55.686455 AM' UNION ALL · SELECT '9/28/2011 11:47:55.123455 AM' UNION ALL · SELECT '11/12/2011 11:47:55.789455 PM' UNION ALL · SELECT '10/9/2011 11:47:55.9996 AM' UNION ALL · SELECT '1/26/2011 11:47:55.3456 PM' UNION ALL · SELECT '1/2/2012 11:47:55.2334455 PM' And the code: SELECT DatetimeasVC , CrsApp1.String , CONVERT( DATETIME , CrsApp1.String) [Converted To DateTime] FROM @Table ·
🌐
Oracle
forums.oracle.com › ords › apexds › post › sql-convert-varchar-to-date-2019-07-24t13-52-04-5510
SQL: Convert varchar to date '2019-07-24T13:52:04'
August 13, 2019 - I have the following varchar type variable that I need to convert to date: '2019-07-24T13:52:04'How to convert this varchar to date?
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › error-converting-data-type-varchar-to-datetime-1
Error converting data type varchar to datetime. – SQLServerCentral Forums
May 19, 2014 - Verify the default language selected for your login in both server. It's look like a format issue regarding the language. ... You could try removing the dashes from your dates. SQL Server will identify the dates without problem regardless of language or dateformat configuration.
🌐
DotFactory
dofactory.com › sql › convert-string-to-datetime
SQL Convert String to DATETIME
SELECT TRY_CONVERT(datetime, '2022-11-01 05:29 PM', 0) AS 'mon dd yyyy hh:miAM/PM)', TRY_CONVERT(datetime, '2022-11-01 05:29 PM', 101) AS 'mm/dd/yyyy', TRY_CONVERT(datetime, '2022-11-01 05:29 PM', 3) AS 'dd/mm/yy', TRY_CONVERT(datetime, '2022-11-01 05:29 PM', 104) AS 'dd.mm.yyyy', TRY_CONVERT(datetime, '2022-11-01 05:29:01 PM', 8) AS 'hh:mi:ss', TRY_CONVERT(datetime, '2022-11-01 05:29 PM', 20) AS 'yyyy-mm-dd hh:mi:ss(24h)' Try it live ... CONVERT and TRY_CONVERT accept a variety of date formats. However, sometimes the disconnect between the input string and the specified style is too far apart.
🌐
W3Schools
w3schools.com › sql › func_sqlserver_cast.asp
SQL Server CAST() Function
CAST(expression AS datatype(length)) Convert a value to a varchar datatype: SELECT CAST(25.65 AS varchar); Try it Yourself » · Convert a value to a datetime datatype: SELECT CAST('2017-08-25' AS datetime); Try it Yourself » ·
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › functions › cast-and-convert-transact-sql
CAST and CONVERT (Transact-SQL) - SQL Server | Microsoft Learn
When you convert between datetimeoffset and the character types char, nchar, nvarchar, and varchar, the converted time zone offset part should always have double digits for both HH and MM. For example, -08:00. Because Unicode data always uses an even number of bytes, use caution when you convert binary or varbinary to or from Unicode supported data types.
🌐
W3Schools
w3schools.com › sql › sql_datatypes.asp
SQL Data Types for MySQL, SQL Server, and MS Access
String Functions: ASCII CHAR CHARINDEX CONCAT Concat with + CONCAT_WS DATALENGTH DIFFERENCE FORMAT LEFT LEN LOWER LTRIM NCHAR PATINDEX QUOTENAME REPLACE REPLICATE REVERSE RIGHT RTRIM SOUNDEX SPACE STR STUFF SUBSTRING TRANSLATE TRIM UNICODE UPPER Numeric Functions: ABS ACOS ASIN ATAN ATN2 AVG CEILING COUNT COS COT DEGREES EXP FLOOR LOG LOG10 MAX MIN PI POWER RADIANS RAND ROUND SIGN SIN SQRT SQUARE SUM TAN Date Functions: CURRENT_TIMESTAMP DATEADD DATEDIFF DATEFROMPARTS DATENAME DATEPART DAY GETDATE GETUTCDATE ISDATE MONTH SYSDATETIME YEAR Advanced Functions CAST COALESCE CONVERT CURRENT_USER IIF ISNULL ISNUMERIC NULLIF SESSION_USER SESSIONPROPERTY SYSTEM_USER USER_NAME MS Access Functions
🌐
W3Schools
w3schools.com › sql › sql_alter.asp
SQL ALTER TABLE Statement
String Functions: ASCII CHAR_LENGTH CHARACTER_LENGTH CONCAT CONCAT_WS FIELD FIND_IN_SET FORMAT INSERT INSTR LCASE LEFT LENGTH LOCATE LOWER LPAD LTRIM MID POSITION REPEAT REPLACE REVERSE RIGHT RPAD RTRIM SPACE STRCMP SUBSTR SUBSTRING SUBSTRING_INDEX TRIM UCASE UPPER Numeric Functions: ABS ACOS ASIN ATAN ATAN2 AVG CEIL CEILING COS COT COUNT DEGREES DIV EXP FLOOR GREATEST LEAST LN LOG LOG10 LOG2 MAX MIN MOD PI POW POWER RADIANS RAND ROUND SIGN SIN SQRT SUM TAN TRUNCATE Date Functions: ADDDATE ADDTIME CURDATE CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURTIME DATE DATEDIFF DATE_ADD DATE_FORMAT DA
🌐
MSSQLTips
mssqltips.com › home › sql date format examples using convert function
SQL Date Format Examples using SQL CONVERT Function
September 26, 2025 - Seventh is SQL CONVERT example where the slashes are replaced by dashes. This can be accomplished using CONVERT option 110. -- The date used for this example was November 12, 2023.
🌐
W3Schools
w3schools.com › sql › func_sqlserver_convert.asp
SQL Server CONVERT() Function
SELECT CONVERT(datetime, '2017-08-25'); Try it Yourself » · Convert an expression from one data type to another (varchar): SELECT CONVERT(varchar, '2017-08-25', 101); Try it Yourself » · ❮ Previous ❮ SQL Server Functions Next ❯ · ★ +1 · Sign in to track progress ·