insert literal date when null

opopanax666

Registered User.
Local time
Yesterday, 16:16
Joined
Nov 2, 2006
Messages
44
hi everybody,

I have a column "EndDate" with some dates filled in, and some null values. I want to create a new column with the filled-in date-values, and the null-values need to be 31/12/2999. So i tried

EndDate2: Nz([EndDate];#31/12/2999#)

but no go, null-fields stay empty.

What did i miss?..
 
So they are not Null?
Have you tested them?

1733224162963.png

Code:
SELECT TestTransactions.ID, Nz([TransactionDate],#12/31/2099#) AS Expr1
FROM TestTransactions;
1733224224503.png
 
Last edited:
🙄 No, they were not... Changed it to an IIF-function, and now it works as intended.

Thank you for the speedy response!
 
Not sure of your regional settings but try a comma instead of a semi-colon.

Code:
Nz([EndDate] , #31/12/2999#)
Nice spot Moke, (y) never noticed the semicolon. :(
 
The one other thing to watch for is that a column might look like there is nothing in it but it isn't null. That happens if the column was originally intended for dates expressed in string format. Not saying that would happen in your specific case, but the better test - where that case applies - is IIF NZ(datefield, "") = "", #31/12/2999#, datefield) - because IF a string CAN be involved, it can be an EMPTY string which is NOT a null but it looks the same to your eye.

Just offering a side note.
 

Users who are viewing this thread

Back
Top Bottom