Inserting data type is DateTime when a null value, why SQL SERVER will automatically add "1900-01-01"

 

The default bar, 
Update TableName time the SET field = '' 
SQL SERVER will automatically add "1900-01-01" 
Update TableName time the SET field = null 
would not be a

 

======================================

null values ​​do not, others will. In the system, time is not a string, but with a decimal number - the number of days after the integer portion represents from 1 January 1900, the fractional part is the number of milliseconds after midnight (like).

 

======================================

datetime / smalldatetime storage format is fixed. 

by the date + time components. 

If the store only time, it will automatically add 1900-1-1 

unless you use character fields to store

========================================

datetime type system which is common to store 8 bytes, the type of digital storage. 

Wherein the first four bytes are used 1900-1-1 days before / after the date of storage, 
wherein the 4 bytes to store the number of milliseconds after 00:00. 

If '' it is the 1900-1-1.

==========================================

Check before being stored, if it is set to NULL is empty 
or take the time to check if it is 1900-01-01, then the empty set, but when this is the case there will be problems printing, it is recommended to use the front One way

Guess you like

Origin blog.csdn.net/allway2/article/details/94555041