<p class="MsoNormal" style="text-indent:15.0pt;mso-char-indent-count:1.5"><span style="font-size:10.0pt;font-family:宋体;mso-ascii-font-family:"Courier New";
mso-hansi-font-family:"Courier New";mso-bidi-font-family:"Courier New";
mso-font-kerning:0pt;mso-no-proof:yes">1)(10分)参考答案不唯一,下面列出两种</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:
0pt;mso-no-proof:yes">Create procedure getDetailByName<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:
0pt;mso-no-proof:yes">@name nvarchar(10)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:
0pt;mso-no-proof:yes">AS<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd;
text-indent:25.0pt;mso-char-indent-count:2.5"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:0pt;
mso-no-proof:yes">IF exists(SELECT * FROM </span><span style="mso-bidi-font-size:
10.5pt;font-family:宋体;mso-ascii-font-family:"Times New Roman"">学生</span> <span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:
0pt;mso-no-proof:yes">Where</span><span style="mso-bidi-font-size:10.5pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">姓名</span><span lang="EN-US" style="font-size:10.0pt;
font-family:"Courier New";mso-font-kerning:0pt;mso-no-proof:yes">= @Name) <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd;
text-indent:50.0pt;mso-char-indent-count:5.0"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:0pt;
mso-no-proof:yes">SELECT * FROM </span><span style="mso-bidi-font-size:10.5pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman"">学生</span> <span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:
0pt;mso-no-proof:yes">Where</span><span style="mso-bidi-font-size:10.5pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">姓名</span><span lang="EN-US" style="font-size:10.0pt;
font-family:"Courier New";mso-font-kerning:0pt;mso-no-proof:yes">= @Name<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd;
text-indent:25.0pt;mso-char-indent-count:2.5"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:0pt;
mso-no-proof:yes">ELSE<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd;
text-indent:49.9pt;mso-char-indent-count:4.99"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:0pt;
mso-no-proof:yes">SELECT \'</span><span style="font-size:10.0pt;font-family:
宋体;mso-ascii-font-family:"Courier New";mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";mso-font-kerning:0pt;mso-no-proof:yes">不存在此学生</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:
0pt;mso-no-proof:yes">\'<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd;
text-indent:25.0pt;mso-char-indent-count:2.5"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:0pt;
mso-no-proof:yes"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd;
text-indent:.3pt;mso-char-indent-count:.03"><span style="font-size:10.0pt;
font-family:宋体;mso-ascii-font-family:"Courier New";mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";mso-font-kerning:0pt;mso-no-proof:yes">参考答案</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:
0pt;mso-no-proof:yes">2</span><span style="font-size:10.0pt;font-family:宋体;
mso-ascii-font-family:"Courier New";mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";mso-font-kerning:0pt;mso-no-proof:yes">:</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:
0pt;mso-no-proof:yes"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:21.0pt;mso-para-margin-left:2.0gd"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";mso-font-kerning:
0pt;mso-no-proof:yes">Create procedure getDetailByName<o:p></o:p
1)(10分)参考答案不唯一,下面列出两种
Create procedure getDetailByName
@name nvarchar(10)
AS
IF exists(SELECT * FROM 学生 Where姓名= @Name)
SELECT * FROM 学生 Where姓名= @Name
ELSE
SELECT \'不存在此学生\'
参考答案2:
Create procedure getDetailByName