title: SQL Stored Procedure set variables using SELECT
body: <p>I have a stored procedure in SQL Server 2005 with multiple variables and I want to set the values of these variables using a select statement. All three variables come from a same table and there should be a way to set them using one select statement instead of the way I currently have as shown below. Please help me to figure it out.</p>
  
  <pre><code>DECLARE @currentTerm nvarchar(max)
  
  DECLARE @termID int
  
  DECLARE @endDate datetime
  
  SET @currentTerm =
  (
      Select CurrentTerm from table1 where IsCurrent = 1
  )
  
  SET @termID =
  (
      Select TermID from table1 where IsCurrent = 1
  )
  
  SET @endDate =
  (
      Select EndDate from table1 where IsCurrent = 1
  )
  </code></pre>