扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:赛迪网 李丝 来源:天新网 2008年3月22日
关键字: 数据库 SQL Server Mssql SQL
在本页阅读全文(共2页)
SQL服务存储过程:
CREATE PROCEDURE SP_DAY_SERVICE AS
UPDATE RES_USER
SET RES_USER.BC=CQ_HB.XBC
FROM RES_USER,CQ_HB
WHERE RES_USER.ACCOUNT_ID=CQ_HB.ACCOUNT_ID AND
DATEDIFF(DAY,CQ_HB.SXRQ,GETDATE())>=0
DELETE FROM CQ_HB WHERE DATEDIFF
(DAY,CQ_HB.SXRQ,GETDATE())>=0 --換班
UPDATE RES_USER SET RES_USER.ZW=CQ_JS.XZW
FROM RES_USER,CQ_JS
WHERE RES_USER.ACCOUNT_ID=CQ_JS.ACCOUNT_ID AND
DATEDIFF(DAY,CQ_JS.SXRQ,GETDATE())>=0
DELETE FROM CQ_JS WHERE DATEDIFF
(DAY,CQ_JS.SXRQ,GETDATE())>=0 --晉升
UPDATE RES_USER
SET RES_USER.BMID=CQ_YD.XZBM,RES_USER.KBID=CQ_YD.XZKB,
RES_USER.XBID=CQ_YD.XZZX,RES_USER.ZW=CQ_YD.XZZW
FROM RES_USER,CQ_YD
WHERE RES_USER.ACCOUNT_ID=CQ_YD.ACCOUNT_ID AND
DATEDIFF(DAY,CQ_YD.SXRQ,GETDATE())>=0
DELETE FROM CQ_YD WHERE DATEDIFF
(DAY,CQ_YD.SXRQ,GETDATE())>=0 --異動
UPDATE RES_USER
SET RES_USER.STATUS=1
FROM RES_USER,CQ_LZ
WHERE RES_USER.ACCOUNT_ID=CQ_LZ.ACCOUNT_ID AND
DATEDIFF(DAY,CQ_LZ.SXRQ,GETDATE())>=0
DELETE FROM CQ_LZ WHERE DATEDIFF
(DAY,CQ_LZ.SXRQ,GETDATE())>=0 --離職
--生成崗位除名數據
INSERT INTO CQ_GWHF(ACCOUNT_ID,BM,KB,ZXB,FULL_NAME)
SELECT TMP0033.ACCOUNT_ID, RES_USER.BMID,RES_USER.KBID,
RES_USER.XBID,RES_USER.FULL_NAME FROM
(
SELECT ACCOUNT_ID
FROM
(
SELECT ACCOUNT_ID,SUM(T) AS KGT
FROM
(
SELECT ACCOUNT_ID,
ST,ET,datediff(HH,ST,ET) as T,
CASE WHEN (DATEDIFF(DAY,ST,GETDATE())>=0)
AND (DATEDIFF(DAY,ET,GETDATE())<=0) THEN 1 ELSE 0 END AS KG
from
(
select ACCOUNT_ID,
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。