title: SQL - Update Query - access the value of a field I set in another field I am setting
body: <p>I am tasked with implementing password hashing and I have to hash all the current user records by writing a SQL script to do it. So far, I have been able to create unique salts (from a different question I also asked) but I'm having trouble trying to actually hash them.</p>
  
  <p>my code is:</p>
  
  <pre><code>UPDATE 
      user
  
  SET 
      pass_salt = left(NEWID(), 13)
      ,user_pwd = convert(varchar(100), HASHBYTES('SHA1', user.user_pwd + user.pass_salt), 2)
  
  WHERE
      security_user_id = 98
  </code></pre>
  
  <p>My issue is I'm not really sure how or if I can access the pass_salt field while setting user_pwd. Currently, it just returns null.</p>
  
  <p>Notes: I am using SQL Server 2012. I am using a 'where' clause to only change one record for testing purposes.</p>
  
  <p>All help is appreciated. Thank you in advance!</p>