顯示廣告
隱藏 ✕
看板 Book11
作者 book11 (不可失憶)
標題 最終方案
時間 2011年07月18日 Mon. PM 05:34:12


DECLARE @dtid varchar(10)
DECLARE @mer_name varchar(255)
DECLARE @mer_edctitle varchar(255)
DECLARE @working_no varchar(255)
DECLARE @mer_mid varchar(255)
DECLARE @mer_address varchar(255)
DECLARE @mer_loc_id varchar(255)
DECLARE @ma_vendor_id varchar(255)
DECLARE @enable_date datetime
DECLARE @rsCount int
DECLARE CUR CURSOR
FOR
SELECT dtid,mer_name,mer_edctitle,working_no,mer_mid,mer_address,mer_loc_id,ma_vendor_id,enable_date FROM repository WHERE dtid
IN ('64900026')AND (asset_category_id = '11' OR asset_category_id = '12')

OPEN CUR
FETCH NEXT FROM CUR INTO @dtid ,@mer_name,@mer_edctitle,@working_no,@mer_mid,@mer_address,@mer_loc_id,@ma_vendor_id,@enable_date
WHILE (@@FETCH_STATUS = 0)
BEGIN

	
	
UPDATE r SET
	
	
	
r.status_id = '6',
	
	
	
r.dtid=@dtid,
	
	
	
r.mer_name=@mer_name,
	
	
	
r.mer_edctitle=@mer_edctitle,
	
	
	
r.working_no = @working_no,
	
	
	
r.mer_mid = @mer_mid,
	
	
	
r.mer_address = @mer_address,
	
	
	
r.mer_loc_id = @mer_loc_id,
	
	
	
r.ma_vendor_id = @ma_vendor_id,
	
	
	
r.carrier = NULL,
	
	
	
r.lease_date_start = NULL,
	
	
	
r.lease_date_end =NULL,
	
	
	
r.lease_date_back = (CASE WHEN r.status_id = '8' THEN GETDATE() ELSE Null END), --借用中則壓歸還日
	
	
	
r.enable_date = (CASE WHEN (r.enable_date IS NULL) THEN @enable_date ELSE enable_date END),
	
	
	
r.modify_date =  GETDATE(),
	
	
	
r.modify_account_id='35'
	
	
FROM repository AS r
	
	
WHERE r.dtid=@dtid AND r.asset_category_id = '17'

	
FETCH NEXT FROM CUR INTO @dtid,@mer_name,@mer_edctitle,@working_no,@mer_mid,@mer_address,@mer_loc_id,@ma_vendor_id,@enable_date
END

--
※ 作者: book11 時間: 2011-07-18 17:34:12
※ 看板: Book11 文章推薦值: 0 目前人氣: 0 累積人氣: 65 
r)回覆 e)編輯 d)刪除 M)收藏 ^x)轉錄 同主題: =)首篇 [)上篇 ])下篇