How did I know that question was coming. :) There are a couple of ways, but this should work.
DECLARE @fd datetime, @esid int SET NOCOUNT ON
Select @fd=DateAdd(Month, 0-10, GetDate()) Select @esid=min(ExternalSystemID)