This video is part of LearnItFirst’s Transact-SQL Programming: SQL Server 2008/R2 course. More information on this video and course is available here:
In order to best demonstrate the differences between the data types, Scott first shows you how to create variables. What is a variable, and what are the differences between scalar and table variables? Is a variable declared in one session available for access in other sessions? What is a good rule of thumb for deciding whether to use SELECT or SET for variable assignment? Scott clarifies all of that and more in this video.
Highlights from this video:
– Global variable vs. local variable
– Understanding “scope”
– How the batch terminator affects variables
– Using SELECT and SET for variable assignment
– Declaring multiple variables