- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
sqlserver存储过程循环写法(Sqlserver stored procedure loop writing)
sqlserver存储过程循环写法(Sqlserver stored procedure loop writing)
Use the cursor and WHILE can traverse each record in your query and the requirements of the field to the corresponding processing variables
Blocked
DECLARE
@A1 VARCHAR (10),
@A2 VARCHAR (10),
@A3 INT
DECLARE CURSOR YOUCURNAME FOR SELECT A1, A2 A3, FROM YOUTABLENAME
OPEN YOUCURNAME
Fetch next from youcurname into @a1, @a2, @a3
While @@fetch_status-1
Begin
Update... Set... =@a1,... =a2... -a3 where...
...... You want to perform a write operation here
Fetch next from youcurname into @a1, @a2, @a3
End
Close youcurname
Deallocate youcurname
--
At the time of application development, application may we often encounter the following, we will query the data table set of records, a record of each cycle, through each record set on another table of data operations, such as insert and update, we assume that there is such a business now. The teacher for the class where students, selected courses such as philosophy, Marxs political economics, introduction to Mao Zedong thought, Deng Xiaoping theory of these classes, now operating as follows:
1) to query these without the graduation list, after graduation to elective;
2) students in the selected volume at the same time, also need to add the corresponding one course;
3) added after the end of the course.
A small amount of data may not be using the Java program directly repeated measures database operation of this implementation weaknesses, because it every time in the operation of the database, there is a direct interaction between I/O and database frequently, this property should not sacrifice it, then well see the following method, realized by vernier method of storage process: the establishment of the stored procedure:
Create PROCEDURE P_InsertSubject
@SubjectId int
AS
DECLARE RS CURSOR LOCAL SCROLL FOR
Select studentID from student where StudentGradu = 1
OPEN RS
FETCH NEXT FROM RS INTO @tempStudentID
WHILE @@FETCH_STATUS = 0
BEGIN
Insert SelSubject values (@SubjectId, @
您可能关注的文档
- ppr十大品牌——飞速发展的金潮管业(PPR ten big brands -- the rapid development of golden tide tube industry).doc
- plc、变频器、触摸屏综合应用实训(PLC, frequency converter, touch screen comprehensive application training).doc
- ppt格式要求(Ppt format requirements).doc
- ppt转换word(PPT转换字).doc
- ppt背景音乐(Ppt background music).doc
- ppr管材详细标准(PPR pipe detail specification).doc
- prada东莞生产贴签意大利造(Prada Dongguan production label, made in Italy).doc
- premiere cs5 安装细则(premiere cs5 安装细则).doc
- ppt高级技巧(Ppt advanced skills).doc
- premiere特效之色彩变换(premiere特效之色彩变换).doc
文档评论(0)