The [PAYOFF DATE] column has several empty values and some values in the format mm / dd / yy.
I need to replace '/' with '-' and return the date as yyyy-mm-dd. The following query does this. The problem is that for all empty values I get the results as 1900-01-01.
Is it possible to replace 1900-01-01 with zero and return other valid date values, as in the format yyyy-mm-dd?
I am using SQL Server.
SELECT cast(replace(a.[PAYOFF DATE],'/','-') as date) FROM MTG a
, . , mm/dd/yyyy, DATE.
mm/dd/yyyy
SELECT cast(a.[PAYOFF DATE] AS DATE) FROM MTG a
1900-01-01, Date, String , , , NULL.
1900-01-01
NULL
, . 1900-01-01 - , SQL- , Date .
sql, - .
SELECT cast(NULLIF(a.[PAYOFF DATE],'') AS DATE) FROM MTG a
Source: https://habr.com/ru/post/1535816/More articles:How to Draw Window Elements in Windows Classic Style - c #Private variables in the Perl Moose class - perlНевозможно очистить весь экран в 16-битном реальном режиме Сборка - assemblyWhere is child_process.js? - node.jsxil_printf and XUartLite_SendByte - cHow to declare a double pointer property in Objective-C? - pointersThe route is mapped to the parameters of a different route - c #Java- Creating a discrete rainbow color scheme - javaHide various implementations behind a common interface in erlang - erlangGoogle Cloud Datastore Console - Service unavailable 503 - google-app-engineAll Articles