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)
 latest date

Author  Topic 

Looper
Yak Posting Veteran

68 Posts

Posted - 2010-06-28 : 08:18:20
I have four dates passed into a stored procedure and want to know the best way to select the latest date of these.

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-06-28 : 08:36:03
SELECT MAX(mydate) FROM (SELECT MyDate = @Date1 UNION ALL SELECT @Date2...) AS a

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com
Go to Top of Page
   

- Advertisement -