From the course: Microsoft SQL Server 2016: Query Data

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Understanding T-SQL programming elements

Understanding T-SQL programming elements - SQL Server Tutorial

From the course: Microsoft SQL Server 2016: Query Data

Start my 1-month free trial

Understanding T-SQL programming elements

- [Instructor] In this lesson we'll take a look at some programming elements that we can use in our Transact Sequel code. We'll take a look at elements such as variables, flow control, and conditional statements that we can use to customize and control our Transact Sequel code execution. The first thing we consider is what is known as a batch. Now this is simply a group of one or more Transact Sequel statements, that are sent to the database engine for processing. And sometimes you can say that they are sent at the same time, which they are, but what the Database Engine does is it will execute them sequentially and it will logically separate the statements based on the batching that we have specified. And that batching specifier is the 'GO' statement. Our first batch that we set up here in this Transact Sequel code is our USE Adventureworks2014 statement. We included this at the top of all of the exercise files for this course, and the main reason that we do so, is because when we…

Contents