ProgrammerAH

Programmer Guide, Tips and Tutorial

Skip to content
  • Home
  • Python
  • PHP
  • JAVA
  • MySQL
  • Linux
  • JavaScript
  • Privacy Policy

Solution of error converting data type varchar to datetime in SQL Server

The Error converting Data type Varchar to Datetime is probably the most common Error of the SQLServer. The Error converting data type Varchar is usually due to the inputting of the date string VarchAR and the default date format in the SQL database, Default_DateFormat, which is commonly found in non-Chinese SQL server. Because SQLServer is available in different languages, the default date format is also “dmy “, “mdy”, “ymd”. Here D is the date, M is the month, and y is the year, but in different order. An error occurs if the date string entered is not in the same order as the default date format of the database system. You can see what language is in what format; you can use the statement from EXEC SP_HELPLANGUAGE.

After checking online, the default language of the database can be set to Chinese to solve the problem, but this only solves the string problem of Insert data, not the problem of using date parameters directly in the StoredProcedure storage method. And for the Chinese date input problem, it is necessary to set the entire database code into Chinese, is not a good solution. And it seems that the date pattern invoked in the StoredProcedure does not depend on the default language of the system, but rather on the version language of the database. Fortunately, SQLServer also provides a method to set the default language of Login Login name, so that we can take the Login account to set the default language of Chinese Login, so as to solve the format conversion error idea.

USE MASTER

EXEC SP_DEFAULTLANGUAGE ‘login name ‘, ‘Simplified Chinese’

This method is tested.

Look at the SQLServer tutorial, it seems that the SQLServer 2005 version of the above, can also be used directly

ALTER LOGIN LOGIN name WITH DEFAULT_LANGUAGE = ‘Simplified Chinese’

But this statement did not compile on my SQL EXPRESS 2008.

In this way, after the user USES the set account to log in, the system default language is the set language, the date format conversion error problem is solved.

Read More:

  • Error converting data type nvarchar to datetime
  • Arithmetical overflow error converting expression to data type datetime
  • Converting string object into datetime type in pandas
  • Arithmetic overflow error converting identity to data type int
  • Arithmetic overflow error converting numeric to data type numeric.
  • Mybatis integrates Oracle query and reports an error in the datetime type field
  • Solution to SQL Server Error: 4064
  • SQL Server 2008 login 4064 error solution
  • SQL Server 2008 18456 error and SA unable to login solution
  • Prompt SQL server error 15023 solution memo when modifying user mapping
  • No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.la
  • This function has none of deterministic, no SQL, or reads SQL data in its error records
  • The solution of PL / SQL can’t connect to the remote server after installing Oracle locally
  • Spring data JAP SQL error:17059 SQL State:99999
  • SQL server error 15404 solution
  • SQL-DataCamp-Analyzing Business Data in SQL
  • Type error: cannot unpack non Iterable non type object appears when starting Bert server in Ubuntu system
  • You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
  • SQL Server 2005, unable to log in, forget sa password, 15405 error!
  • 12-web security — error injection based on SQL Server — and, convert, cast

This entry was posted in How to Fix and tagged data, login, sqlserver, The database on 2020-11-10 by Robins.

Post navigation

← .. ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status make[2]: *** Jython installation →

Recent Posts

  • MAFIA: 1- OpenFlow statistics (Counters, Timestamps)(mafia-sdn/p4demos/demos/1-openflow/1.1-statistics/p4src/of.p4)
  • LDSC: Could not open Corces_ATAC_1000Gv3_ldscores/Corces_ATAC.1.1.l2.ldscore[./gz/bz2]
  • Gradle Package Project Lombok Not Working: No serializer found for class com.qbb.User and no properties discovered to create BeanSerializer……
  • [Solved] PCH Warning: header stop not at file scope
  • pymysql Error: File “/usr/local/lib/python2.7/site-packages/PyMySQL-1.0.2-py2.7.egg/pymysql/connections.py”, line 167 SyntaxError: invalid syntax

Tags

  • Android
  • Android studio
  • back-end
  • Big data
  • bug
  • c++
  • cents
  • database
  • Deep learning
  • development language
  • docker
  • eclipse
  • error
  • front end
  • git
  • Hadoop
  • idea
  • intellectual idea
  • java
  • javascript
  • linux
  • maven
  • mybatis
  • mysql
  • node.js
  • Npm
  • OpenCV
  • Operation and maintenance
  • php
  • ProgrammerAH
  • python
  • pytorch
  • qt
  • report errors
  • solution
  • spring
  • spring boot
  • SQL
  • tensorflow
  • The database
  • The server
  • tomcat
  • ubuntu
  • View.js
  • windows
Proudly powered by WordPress