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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started