DECLARE and SET a variable
Using variables makes it easy to run a query multiple times, with different values, without having to scroll down and amend the WHERE clause each time. You can quickly update the variable at the top of the query instead.
This also helps provide greater security, but that is out of scope of this course.
Let's go back to the now very familiar grid table for this exercise, and use it to practice extracting data according to your newly defined variable.
Bu egzersiz
Introduction to SQL Server
kursunun bir parçasıdırUygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
-- Declare the variable @region, and specify the data type of the variable