Hi
In a query if value is 1900-01-01 00:00:00.000 then '' should be displayed.
Thanks
Hi
In a query if value is 1900-01-01 00:00:00.000 then '' should be displayed.
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anandu G NathPosted Dec 20, 2023, 5:36 AM
Saravanan GanesanPosted Aug 16, 2023, 10:15 AM
To display an empty string (
'') when the value in a query is1900-01-01 00:00:00.000, you can use theCASEstatement to conditionally format the output. Here's an example of how you can achieve this:Replace
YourColumnwith the actual name of the column in your table andYourTablewith the actual name of the table. This query uses theCASEstatement to check if the value is'1900-01-01 00:00:00.000'and replaces it with an empty string. If the value is different, you can use theCONVERTfunction to format it as needed (in this case, it's converted to the ISO 8601 format with the style code120).Cr BhargaviPosted Aug 10, 2023, 11:40 AM
Nitin SontakkePosted Aug 10, 2023, 4:11 AM
The problem is not at the SQL Server end. You are unlikely to have this value stored in db.
Problem is this column is either null, or is of data type string and is empty. When such is the case, it gets translated as above value in C#.
So you will have to deal with this there!
Ramco RamcoPosted Aug 10, 2023, 3:21 AM
Hi
I have written below code but it is showing NULL
case WHEN HRTST = '1900-01-01 00:00:00.000' THEN '' end
Thanks
Tahir AnsariPosted Aug 9, 2023, 12:55 PM
assume you have a table named
Orderswith a column namedOrderDate. You want to display an empty string when theOrderDateis '1900-01-01 00:00:00.000'.Mohammad HussainPosted Aug 9, 2023, 12:10 PM