How To Declare and Initialize Variables in T-SQL (Part 1)

Công Nghệ

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

and much more…


Xem thêm bài viết khác:

9 thoughts on “How To Declare and Initialize Variables in T-SQL (Part 1)

  1. Love how you explain the impacts of the GO and the impacts of it. "Variables are scoped to the batch" and "batch terminator (GO) destroys all variables in the batch". Most variable documentation / explanations don't spend any time on this.

  2. Most talented and exceptionally gifted trainer. Your deep knowledge and pedagogy always amaze me everytime I watch your videos. Keep it up.

  3. You are one of the best teachers I've ever seen. I had two issues with some of my homework I didn't understand, and in two videos you solved all of my problems inadvertently. Fantastic attention to detail and an incredible ability to cover all bases while teaching people to code. 100/10 Exceptional Job.

Leave a Reply

Your email address will not be published. Required fields are marked *