title: Suppress error message in SQL Server 2008
body: <p>I have the following code. When executed it prints </p>
  
  <blockquote>
    <p><em>Msg 8120, Level 16, State 1, Procedure Test, Line 17<br>
    Column '@t.Country' is invalid in the select list because it is not contained
    in either an aggregate function or the GROUP BY clause. ERROR'</em></p>
  </blockquote>
  
  <p>But I want only <code>'ERROR'</code> to be printed. Is there a way to suppress the error message?</p>
  
  <p>Thanks
  Satyaprakash J</p>
  
  <pre><code>CREATE PROCEDURE Test
  AS
      DECLARE @t TABLE
          (ID INT IDENTITY(1,1)
          ,Country NVARCHAR(50)
          ,Year INT
          ,PopulationInMillions INT
          )
  
      INSERT @t (Country, Year, PopulationInMillions)
      VALUES ('US', 2000, 20),
             ('US', 2001, 22) 
  
      SELECT Country, MAX(PopulationInMillions)
      FROM @t       
  GO
  
  BEGIN TRY
      EXEC Test
  END TRY
  BEGIN CATCH
      PRINT 'ERROR'
  END CATCH
  </code></pre>