Mục tiêu:
!"#$$%"&'()*+$),"-)./012+"
.134+.5 678.13++"*9:.13
#$$;(+#<:=>#<?+@+
A *-.B4+#$$C+"
SELECT vFirstName, vLastName, vEmailId
FROM Shopper
678,DEF.B*-&
G 8,D EF:*7./0*B<&
*+$),"C./0.C
H 8,D EF.B&$I9C+1"
*#)+"
J 8,D EFC&K"+4+.B
&I9C+"*#)+"+
L MC",DK"+
N ,D"+)*OPB+E+"+F*P
+C+EQ""+F,"C".0.13
R 8,D6"+"+:*C".0*B<
PS)TE"+"+F ,D&UD+,D"+
V3T6"+"+W+"+XVY""+
Z [10+\".134+.B8,DB<79
E#""F10+%+8779E#"F
CREATE PROCEDURE prcBrand @cBrandId char(3) OUTPUT,
@cBrandName char(16)
as
SELECT @cBrandName = cBrandName
FROM ToyBrand WHERE cBrandId = @cBrandId
";]+',D.13U*^$9"
DECLARE @cBrandName char(16)
exec prcBrand '001',@cBrandName OUTPUT
SELECT @cBrandName
_7$>"*\B<&7910+%+ 67U">*
8,D"+`a`b.BB<&*.<"
c,"-);$"+d8B#"+.13
[!"10+\"4+.B8,D#e+5,"8
,+!"^*#)+"+
CREATE PROCEDURE prcAddCategory @CategoryId char(3),
@Category char(20), @Descrip char(30)
as
INSERT Category VALUES('CategoryId','Category','Descrip')
";,D.13"]+'$9".134+.BU
exec prcAddCategory '017','War Games','A wide range of toy guns'
9#<#$>*;(+9.13 67U">,D&
A ,DV`7C".0C8+1"
CREATE PROCEDURE prcGenOrder
@OrderNo char(6)OUTPUT
as
SELECT @OrderNo=Max(cOrderNo) FROM Orders
SELECT @OrderNo=
CASE
WHEN @OrderNo >=0 and @OrderNo<9 Then
'00000'+Convert (char, @OrderNo+1)
WHEN @OrderNo>=9 and @OrderNo<99 Then
'0000'+Convert (char, @OrderNo+1)
WHEN @OrderNo>=99 and @OrderNo<999 Then
'000'+Convert (char, @OrderNo+1)
WHEN @OrderNo>=999 and @OrderNo<9999 Then
'00'+Convert (char, @OrderNo+1)
WHEN @OrderNo>=9999 and @OrderNo<99999 Then
'0'+Convert (char, @OrderNo+1)
WHEN @OrderNo>=99999 Then Convert (char, @OrderNo+1)
END
RETURN
f;$+]$:"'$#1^"g.139
" _7C".0.132,D&
# _7C".0'+9'"h'*hg.13.1"*
#)+`
$#1^&).1394+gE)"F
67B+"<&8,D*^"h*h
",",D
G f+12"+EF&g+CSC./0!"'
$#1^g9*^C".0,";$1"
" 8PVY"&1*^+$<iaj*8P"h&
.13::*^7+CSEQ"F.7.13;$!
# kP+CSE+YQ""+Fg.13::
$#1^&g)"
67B+"<&8,D*^C".0'7./0'*
7+CS"
H ,D+hYB<&'!;$++3
T,"+12+! l5+12+!;(++-&!g]\mn
.<,D)*O-)+12"+C&#?.g oPDCB
+!,D$$"
EXECUTE +hY;
Or
EXECUTE +hYN'Wi%';
Or
EXECUTE +hY@FirstName = N'%';
Or
EXECUTE +hYN'[CK]ars[OE]n';
Or
EXECUTE +hY N'Hesse', N'Stefen';
Or
EXECUTE +hYN'H%', N'S%';
J ,DB<5.mn+p+7&n1"
&&n _7./0 &./0 13+
[/0g).mn&+513+/;1^A'13+.mn
4(n*.0+$5+$qr'\13+.mnA'+$qrA\
13+.mn'+1313+.mnJ