declare @latetimeminute as int
declare @flag as int
select @flag=datediff(n,convert(char(10),getdate(),120)+' 08:00:00',getdate())
if @flag>0
begin
exec ('master..xp_cmdshell ''net send 192.168.0.188 注意:您迟到了'+@flag+'分钟,下次注意!系统已经记录到公司考勤记录!''')
end
else
begin
exec ('master..xp_cmdshell ''net send 192.168.0.188 恭喜您,您今天没有迟到,您早到了'+@flag+'分钟,谢谢''')
end
declare @flag as int
select @flag=datediff(n,convert(char(10),getdate(),120)+' 08:00:00',getdate())
if @flag>0
begin
exec ('master..xp_cmdshell ''net send 192.168.0.188 注意:您迟到了'+@flag+'分钟,下次注意!系统已经记录到公司考勤记录!''')
end
else
begin
exec ('master..xp_cmdshell ''net send 192.168.0.188 恭喜您,您今天没有迟到,您早到了'+@flag+'分钟,谢谢''')
end
2。计算机名称要能解析的到
3。如果不能解析到,则可以用ip address
declare @flag as int
select @flag=datediff(n,convert(char(10),getdate(),120)+' 08:00:00',getdate())
declare @cmd varchar(200)
if @flag>0
begin
set @cmd='net send ZF 注意:您迟到了'+cast(@flag as varchar)+'分钟,下次注意!系统已经记录到公司考勤记录!'
exec master..xp_cmdshell @cmd
end
else
begin
set @cmd='net send ZF 恭喜您,您今天没有迟到,您早到了'+cast(@flag as varchar)+'分钟,谢谢'
exec master..xp_cmdshell @cmd
end
declare @flag int
select @flag=datediff(n,cast((convert(char(10),getdate(),120)+' 08:00:00') as datetime),getdate())
if @flag>0
begin
print 'aa'
end
else
begin
print 'bb'
end