title: Declare Variable for a Query String
body: <p>I was wondering if there was a way to do this in MS SQL Server 2005:</p>
  
  <pre><code>  DECLARE @theDate varchar(60)
    SET @theDate = '''2010-01-01'' AND ''2010-08-31 23:59:59'''
  
    SELECT    AdministratorCode, 
              SUM(Total) as theTotal, 
              SUM(WOD.Quantity) as theQty, 
              AVG(Total) as avgTotal, 
              (SELECT SUM(tblWOD.Amount)
                  FROM tblWOD
                  JOIN tblWO on tblWOD.OrderID = tblWO.ID
                  WHERE tblWO.Approved = '1' 
                  AND tblWO.AdministratorCode = tblWO.AdministratorCode
                  AND tblWO.OrderDate BETWEEN @theDate
              )
   ... etc
  </code></pre>
  
  <p>Is this possible to do?</p>