Friday, 15 March 2013

How do I stop SQL Server converting 1900-01-01 to NULL -


How does 1900-01-01 to NULL , But my problem is the opposite I have stored the smalldatetime (SQL Server 2008) processing processes, but they are 1 9 00-01-01 to NULL to change, when I really want it to be 19 00-01-01 . Any ideas?

Thanks

By default, SQL Server can not distinguish.

19 00-01-01 00: 00: 00.000 is the era (zero point) for the SQL server's calendar and if you have SQL Server Says something like this:

  select 'empty string', convert (datetime, '')  

this conversion algorithm is an error Throwing, this converts the empty string into the SQL server date / time value ... (you guess it!) ... '19 00-01-01 00.00.00.000'

What is the value with null is dependent on the current setting of the SQL Server SET option SET CONCAT_NULL_YIELDS_NULL . If shutdown , zero values ​​behave essentially equally for empty wires.

As long as you have a stored procedure problem (stored procedure changes a date / time 1 9 00-01-01 in null Value ... that is a problem with your stored procedures. SQL Server will not automatically change the non-redundant date / time value 1 9 00-01-01 00.00.00.000 to Null : Someone is explicitly doing this.

And tap to treat earlier versions of SQL Server and The lary string interchangably with the very default. I suspect that your system has been around for a long time.

As a result, SQL Server is a difficult to distinguish a real, non-redundant date / time value Time is 1 9 00-01-01 00.00.00.000 to '' and null

My suspicion, because you We have no code, we have no code, it's a code somewhere in your stored procedure that looks like this:

  select some_date_time_column = case when t.some_date_time_column == '' tap and something Some_table T  
ends with

No comments:

Post a Comment