6442.html

来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 23 行

HTML
23
字号
<html>
  <head>
    <title>Re: 请问以下SQL程序有何错误</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>Re: 请问以下SQL程序有何错误</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by <a href="mailto:amoschen@email.gcn.net.tw">大头</a> on October 13, 1998 at 16:54:32:<p>
In Reply to: <a href="6440.html">请问以下SQL程序有何错误</a> posted by 孤帆 on October 13, 1998 at 14:28:48:<p>
: <br>: CREATE PROCEDURE UPDATE_TDUTYRCD<br>:  (@d1 char(7),@d2 char(5),@d3 char(5))<br>: AS<br>:   select employee,sum(hour88) as hour<br>:          into #tday<br>:          from t_transduty <br>:          where convert(char(8),date,112) like @d1<br>:           and  type = '5'  <br>:          group by employee<br>:   <br>:   select t_dutyrcd.employee,(already + hour) as aa<br>:          into #tday2<br>:          from t_dutyrcd join #tday on t_dutyrcd.employee=#tday.employee<br>:          where date=@d2  <br>:   <br>:   update t_dutyrcd set already=aa <br>:          where t_dutyrcd.employee=#tday2.employee <br>:          and t_dutyrcd.date=@d3<br>:   <br>: RETURN<p>: GO<p>: 错误讯息如下:<br>: ERROR 107:[SQL Server] The coiumn prefix '#tday2' does not match<br>:       with a table name or alias name used in the query.<p>错在Update 那边.因为你Where 来自于两个档.<br>所以你少下了 from t_dutyrcd,#tday2<br>了了吗 ??
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 6442-->
</ul><!--end: 6442-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?