Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
SELECT CASE WHEN CAST(GETDATE() AS DATE) = DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0) THEN 1 ELSE MAX ([' + @ColumnName1 + ']' + ' ) END Output' + ' FROM [dbo].[' + @tableName + ']'
select max (cast(ref as int)) as ref from table1 order by ref