Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to make a null date default to today's date

Author  Topic 

bh0526
Yak Posting Veteran

71 Posts

Posted - 2010-06-16 : 16:37:20
I have the following simple SQL statement:

SELECT PODetailID,
ACK855Quantity,
EstimatedDeliveryDate,
POACKDescription
FROM PODetail
WHERE POHeaderID = @POHeaderID

This works but I want to return today's date for EstimatedDeliveryDate if the value is null for this column. I want the date to look like 6/16/2010.

How can I do this?

Bob

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-06-16 : 16:39:53
CONVERT(VARCHAR(10), COALESCE(EstimatedDeliveryDate, GETDATE()), 101)



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -