title: Using case expression in SELECT when using TOP
body: <p>I want to select only the top 50 records when my customer is a certain customer.  Otherwise select all records.  I have the following (a simplified version).  I am on SQL Server 2000.  Can this be done?</p>
  
  <pre><code>DECLARE @custnum AS VARCHAR(7)
  SET @custnum = '1234567'
  SELECT CASE @custnum 
          WHEN '1234567' THEN [TOP 50 DISTINCT]
          ELSE [DISTINCT]
          END
          item1, item2
  FROM myTable
  WHERE myCust = @custnum
  </code></pre>