title: How to declare variable in sql update statement
body: <p>how to update with a new variable</p>
  
  <p>let's say I wanted to do the following</p>
  
  <pre><code>update T
  set T.property1 = (declare @temp varch(20)
                             @temp = 'testing')
  from #temp_table_name T
  </code></pre>
  
  <p>is this possible.  I need to update a table but the new element is the end result of a series of complicated statements and it would be a lot easier to define some variables along the way to handle intermediate outputs.  What is the correct syntax for what I'm trying to do above because it's not working</p>