新聞中心
下面將為您介紹sql server2005循環(huán)操作實例,供您參考,如果您對sql server2005相關(guān)方面感興趣,不妨一看,相信對您學(xué)習(xí)sql數(shù)據(jù)庫的循環(huán)操作會有所幫助。

ALTER PROCEDURE [dbo].[Proc_DeleteJobseeker]
@JobseekerID UniqueIdentifier -- 求職者ID
AS
BEGIN
update JobSeekerUser
set Status=9 --刪除
where JobSeekerID=@JobseekerID
--更新搜索引擎
select resumeID,JobSeekerID,ROW_NUMBER()
OVER(ORDER BY resumeID) AS rowNumber into #depTemp--求職者所有簡歷
from ResumeBase
where JobSeekerID=@JobseekerID
declare @max int--簡歷數(shù)
--用來獲得最大的rowNumber
select @max=max(rownumber) from #depTemp
declare @rowNo int --行號
set @rowNo=1
declare @resumeID UniqueIdentifier--簡歷ID
while @rowNo<=@max
--用來對每一個rowNumber來進行循環(huán)操作
begin
select @resumeID=resumeID from #depTemp
where rowNumber=@rowNo
--更新搜索引擎
exec proc_UpdateJobseekerDataForIndex @resumeID,4, 1,0
--此處對每一行要進行的操作的代碼
set @rowNo=@rowNo+1
end
drop table #depTemp--清除臨時表
END
--sp_helptext 'proc_InsertJobseekerCheck'
--sp_helptext 'proc_UpdateJobseekerDataForIndex'
【編輯推薦】
詳解SQL中循環(huán)結(jié)構(gòu)的使用
sql循環(huán)語句和多分支語句的語法介紹
sql多數(shù)據(jù)庫查詢批量插入問題循環(huán)
SQL中游標嵌套循環(huán)的示例
sql循環(huán)插入的語句寫法
分享文章:sql server2005循環(huán)操作實例
當(dāng)前路徑:http://m.fisionsoft.com.cn/article/djiphhg.html


咨詢
建站咨詢
