How long do they take to run?
How long does a potentially SARGable SELECT MAX(CONVERT(smalldatetime, CAST(MonthValue AS varchar) + '/01/' +
CAST(YearValue AS varchar))) AS ValueDate
FROM (
SELECT TOP 1 YearValue, MonthValue
FROM dbo.myTable
ORDER BY YearValue DESC, MonthValue DESC
) d
query take?
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]