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.. :)
-
DECLARE @MyVariable int
-
SELECT @MyVariable = MyColumn FROM TABLE;
You wouldn’t believe how difficult this was to find, but it’s easy when you know how.. :)