title: sql server instead of trigger insert statement with variables and values from inserted
body: <p>I have an instead of trigger.  I have a value in a variable.</p>
  
  <p>I would like to insert the value into one of the columns and use the fields from inserted. This is what I am trying to accomplish:</p>
  
  <pre><code>declare @someLocalVariable varchar(9)
  
  set @someLocalVariable = dbo.someLocalUDF()
  
  INSERT myTable (field1, field2, field3)
  VALUES (@someLocalVariable, (select field2, field3 from inserted))
  </code></pre>