Posted: 6 years ago

Filed under: SQL server

Tagged with: sql transact-sql

Follow comments

Saving a single value from a query to a variable in Transact SQL

You wouldn’t believe how difficult this was to find, but it’s easy when you know how.. :)

  1. DECLARE @MyVariable int
  2. SELECT @MyVariable = MyColumn FROM TABLE;

Leave a Reply