Using MS SQL Server 2008, I'm doing a query to calculate the Max date of 10 Columns for each Row. That query is below. I also need to list the name of that column that has the Max date. So the Query would give me the [Last Step Date] and the [Last Step Name]. How do I get the [Last Step Name]?
SELECT (SELECT MAX(LastUpdateDate) FROM (VALUES ([Step 1]), ([Step 2]), ([Step 3]), ([Step 4]), ([Step 5]), ([Step 6]), ([Step 7]), ([Step 8]), ([Step 9]), ([Step 10]) ) AS UpdateDate(LastUpdateDate)) AS [Last Step Date] FROM MyTable