在JOB(作业)里的script语法检查里, 情况1: 我写的这个,Insert into TimeLength96163 ( UserID,IPAddress,LoginTime,LogoutTime)后面什么都没有了,可是语法检查是对的。if exists(Select UserID from WorkTable96163 where IPAddress = @chvIPAddress) --查看这个IP有用户登录 begin -- 只有一次登录与登出时间相差10分钟才有效 --print '' Insert into TimeLength96163 ( UserID,IPAddress,LoginTime,LogoutTime) -- select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 --Insert into TimeLength96163_Backup ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Update WorkTable96163 set UserID = @intUserID,LoginTime = Getdate(), LogoutTime = Getdate() where IPAddress = @chvIPAddress
end 是通不过的
CREATE PROCEDURE aa @chvIPAddress int, @intUserID int As if exists(Select UserID from WorkTable96163 where IPAddress = @chvIPAddress) --查看这个IP有用户登录 begin -- 只有一次登录与登出时间相差10分钟才有效 print '' Insert into TimeLength96163 ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Insert into TimeLength96163_Backup ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Update WorkTable96163 set UserID = @intUserID,LoginTime = Getdate(), LogoutTime = Getdate() where IPAddress = @chvIPAddress
end 是对的呀!
CREATE PROCEDURE aa @chvIPAddress int, @intUserID int As if exists(Select UserID from WorkTable96163 where IPAddress = @chvIPAddress) --查看这个IP有用户登录 begin -- 只有一次登录与登出时间相差10分钟才有效 print '' Insert into TimeLength96163 ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Insert into TimeLength96163_Backup ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Update WorkTable96163 set UserID = @intUserID,LoginTime = Getdate(), LogoutTime = Getdate() where IPAddress = @chvIPAddress
我写的这个,Insert into TimeLength96163 ( UserID,IPAddress,LoginTime,LogoutTime)后面什么都没有了,可是语法检查是对的。if exists(Select UserID from WorkTable96163 where IPAddress = @chvIPAddress) --查看这个IP有用户登录
begin
-- 只有一次登录与登出时间相差10分钟才有效
--print ''
Insert into TimeLength96163 ( UserID,IPAddress,LoginTime,LogoutTime) -- select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 --Insert into TimeLength96163_Backup ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Update WorkTable96163 set UserID = @intUserID,LoginTime = Getdate(), LogoutTime = Getdate() where IPAddress = @chvIPAddress
end 是通不过的
@chvIPAddress int,
@intUserID int
As
if exists(Select UserID from WorkTable96163 where IPAddress = @chvIPAddress) --查看这个IP有用户登录
begin
-- 只有一次登录与登出时间相差10分钟才有效
print ''
Insert into TimeLength96163 ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Insert into TimeLength96163_Backup ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Update WorkTable96163 set UserID = @intUserID,LoginTime = Getdate(), LogoutTime = Getdate() where IPAddress = @chvIPAddress
end 是对的呀!
@chvIPAddress int,
@intUserID int
As
if exists(Select UserID from WorkTable96163 where IPAddress = @chvIPAddress) --查看这个IP有用户登录
begin
-- 只有一次登录与登出时间相差10分钟才有效
print ''
Insert into TimeLength96163 ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Insert into TimeLength96163_Backup ( UserID,IPAddress,LoginTime,LogoutTime) select UserID,IPAddress,LoginTime,LogoutTime From WorkTable96163 where IPAddress = @chvIPAddress and datediff(Minute,LoginTime,LogoutTime)>=10 Update WorkTable96163 set UserID = @intUserID,LoginTime = Getdate(), LogoutTime = Getdate() where IPAddress = @chvIPAddress
end
确实是对的!