Question: --declare a variable named @var (variable names must begin with @ in SQL Server) declare @var int --assignment statement, calculate expression & store result in
--declare a variable named @var (variable names must begin with @ in SQL Server)
declare @var int
--assignment statement, calculate expression & store result in variable
select @var = 100 40 * 2
--display what is stored in a variable for the DBA to see (in Message window)
--Click on Messages tab when you run this code to see the output
print 'Variable stores:'
print @var
--using the variable: Display all of the part information for those parts whose
-- quantity onhand is less than the value stored in @var
--FILL IN CODE HERE--
--store result of a query in a variable
--this code replaces the value stored in @var with a new value
select @var = partnum
from Part
where Description = 'Iron'
--display a message describing what is stored in @var
--along with the actual value stored in @var
--the code provided above shows an example of how to do this
--FILL IN CODE HERE
--Modify all orderlines that contain the part referred to by @var
--as follows: increase the NumOrdered by 1
--FILL IN CODE HERE--
--Get a list of all the customers who ordered the part referred to by @var
--FILL IN CODE HERE--
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
