⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_52108.htm

📁 vc
💻 HTM
字号:
<p>
序号:52108 发表者:我的名字叫飞 发表日期:2003-09-08 09:08:08
<br>主题:关于cursor的问题???
<br>内容:我想用cursor去进行update,delete,但每次都是报<BR><BR>服务器: 消息 16929,级别 16,状态 1,行 5<BR>游标是 READ ONLY 的。<BR>语句已终止。<BR><BR>我在定义cursor也加不上for update <BR>服务器: 消息 16957,级别 16,状态 4,行 2<BR>在 READ ONLY 游标上不能指定 FOR UPDATE。<BR><BR>而且我也在源表上定义了一个主索引。<BR><BR>谢谢你了.
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:jamesgu2008 回复日期:2003-09-08 09:46:12
<br>内容:你要在cursor前加SCROLL才能更新。再不行,就把你写的CURSOR贴出来,让大家帮你看看。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:我的名字叫飞 回复日期:2003-09-08 10:43:12
<br>内容:use temp<BR>go<BR><BR>create table Mytable (id int identity(1,1),b nvarchar(20))<BR>go<BR><BR>insert Mytable (b)&nbsp;&nbsp;values ('a')<BR>insert Mytable (b)&nbsp;&nbsp;values ('b')<BR>insert Mytable (b)&nbsp;&nbsp;values ('c')<BR>insert Mytable (b)&nbsp;&nbsp;values ('d')<BR>insert Mytable (b)&nbsp;&nbsp;values ('e')<BR>insert Mytable (b)&nbsp;&nbsp;values ('f')<BR>insert Mytable (b)&nbsp;&nbsp;values ('g')<BR><BR>declare mytable_cur scroll cursor<BR>&nbsp;&nbsp;&nbsp;&nbsp;for select * from mytable<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>go<BR><BR>open mytable_cur<BR>fetch last from mytable_cur<BR>--我想将最后一行删除<BR>delete mytable where current of mytable_cur<BR><BR>但是服务器报:<BR>服务器: 消息 16929,级别 16,状态 1,行 5<BR>游标是 READ ONLY 的。<BR>语句已终止。<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:jamesgu2008 回复日期:2003-09-08 11:49:58
<br>内容:declare mytable_cur cursor dynamic<BR>&nbsp;&nbsp;&nbsp;&nbsp;for select * from mytable <BR> open mytable_cur<BR>fetch last from mytable_cur<BR>delete mytable where current of mytable_cur<BR>close mytable_cur<BR>deallocate mytable_cur<BR><BR>DYNAMIC<BR><BR>定义一个游标,以反映在滚动游标时对结果集内的行所做的所有数据更改。行的数据值、顺序和成员在每次提取时都会更改。动态游标不支持 ABSOLUTE 提取选项。<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:我的名字叫飞 回复日期:2003-09-08 12:17:10
<br>内容:谢谢<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:redgate 回复日期:2003-09-23 15:40:58
<br>内容:hao 
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

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