Select ¡@Convert(Char(8),Getdate(),112)+RIGHT('0000' + cast((cast (right(IsNull(max(ColumnName),0),4) as int)+1) as varchar) , 4) from TableName where ColumnNamelike (Convert(Char(8),Getdate(),112) +'%')