12

An old famous question was recently solved on SciFi.SE and the answer has got 2500 reputation as bounty so far.
Answer of famous Number 3 Monster question: https://scifi.stackexchange.com/a/105743/931 (Check comments on it to get an idea; Blog Post)

It got me wondering which answer in SE network has earned highest bounty.

19

The answer from Shog9 is OK-ish but will lose accuracy over time. I created the following SEDE query that enables you to get an accurate result once a week (as the SEDE db is refreshed in the weekend).

-- start create url from dbname
IF OBJECT_ID ( '#siteurl', 'P' ) IS NOT NULL 
    DROP PROCEDURE #siteurl;
GO
create procedure #siteurl
   @dbname nvarchar(250),
   @res nvarchar(250) OUT
   as
   begin
      -- we have three sites that have borked DNS entries
      set @dbname = (case @dbname
      when 'StackExchange.Audio' then 'StackExchange.Avp'
      when 'StackExchange.Audio.Meta' then 'StackExchange.Avp.Meta'
      when 'StackExchange.Mathoverflow.Meta' then 'net.Mathoverflow.meta'
      else @dbname
      end)
      -- and one of those doesn't want to end with .com
      if @dbname <> 'net.Mathoverflow.meta' 
         set @dbname = 'com.' + @dbname
      exec #recursesiteurl @dbname,  @res OUTPUT
   end
GO
-- create url from dbname
IF OBJECT_ID ( '#recursesiteurl', 'P' ) IS NOT NULL 
    DROP PROCEDURE #recursesiteurl;
GO
create procedure #recursesiteurl
   @dbname nvarchar(250),
   @res nvarchar(250) OUT
   as
   begin
      declare @pos integer
      declare @rec nvarchar(250)

      set @res = @dbname
      set @pos = CHARINDEX('.', @dbname)
      if (@pos > 0 ) 
      begin
         set @rec = substring(@dbname, @pos+1, len(@dbname))
         exec #recursesiteurl @rec,  @rec output
         set @res = @rec 
                  + '.' 
                  + substring(@dbname, 0, @pos) 
      end
   end;
GO

-- all databases
declare  db_c cursor for select [name] 
                         from sys.databases 
                         where database_id > 5 -- skip master, temp, model, msdb, Data.SE

declare @db_c_name sysname   -- holds name of db after fetch
declare @sql nvarchar(max) -- holds build up sql string

-- result table
create table #all_posts ( site nvarchar(250)
                            , bcount int
                            , bsum int
                            , id int
                            , title nvarchar(250)
                            );

open db_c
fetch next from db_c into @db_c_name
while(@@FETCH_STATUS = 0)
begin
    set @sql = N'use '+ QUOTENAME(@db_c_name) +';
               declare @url nvarchar(250)
               exec #siteurl ''' + @db_c_name  + ''', @url output
               insert into #all_posts 
               select TOP 1 @url
               , Count(v.Id) AS IdCount
               , Sum(v.BountyAmount)
               , v.postid
               , (select q.title 
                  from posts q 
                  inner join posts a on a.parentid = q.id
                  where a.id = v.postid) as title
               FROM Votes v
               WHERE v.BountyAmount IS NOT NULL 
                 AND v.VoteTypeId = 9 -- BountyStart
               GROUP BY v.PostId
               ORDER BY Sum(v.BountyAmount) DESC;'
    exec (@sql)
   fetch next from db_c into @db_c_name
end;
close db_c;
deallocate db_c;

select replace(
       replace(
       replace(site,
         '.StackExchange.com',''),
         '.com',''),
         '.net','') as [site]
     , 'http://' 
     + site 
     + '/q/'
     + cast(id as nvarchar)
     + '|'
     + title as question
     , bsum as [Sum of bounties]
     , bcount as [Number of bounties]
from #all_posts
order by bsum desc

drop table #all_posts

drop procedure #recursesiteurl
drop procedure #siteurl

Which shows the following result today, confirming the answers linked to by Shog9:

sum of bounties across all sites

9

Your question is a bit inaccurate... The answer you reference has currently earned a total of 2000 points in accumulated bounties. There's another 500-point bounty currently offered on the question, and it seems likely that it'll be awarded to the answer as well...

...But since you didn't wait ask this question, the answer is likely different from what it might have been.

The answer to earn the most bounty-rep anywhere on Stack Exchange is...

An answer to How to extract each pair of two adjacent cells of a table into a separate tight page? on TeX - LaTeX, with 2050 points at the time of this answer's creation.

Runners-up include Improve GeSHi syntax highlighting for T-SQL on Stack Overflow and Story where the number 3 is the monster? on Science Fiction and Fantasy, each with 2000 points.

  • 1
    Well, the answer to "Story where the number 3 is the monster?" has a +3150 by now. – ShaWiz Jan 26 '17 at 7:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .