what?
以上的代碼你怎麼知道总是rollback transcation?將全部代碼貼出來啊 !
以上的代碼你怎麼知道总是rollback transcation?將全部代碼貼出來啊 !
解决方案 »
- 请教一个很简单的SQL语句
- 查找两表中的异。
- sql2005 数据库注册
- 请教一个入门的问题,如何生成系统动编号的字段?
- SQL SERVER 2000能否在服务器上新建一个属于administrators组的windows用户
- 【求SQL语句】关于自动编号,取字段长度(数据库SQL SERVER2000 up有分)
- sql2000企业版用打补丁么?
- 两个字段(起始时间和结束时间)如何统计访问的高峰时段??
- 汇总相关..感觉不是太难..但始终试不出来该怎么写。。(就这么多分了,挺着急的,请指教)
- 紧急求救
- ASP与SQL连接;“企业管理器”查询超时二个问题。
- 请问游标的结果集是否可以来自一个存储过程?
FOR INSERT
AS
declare @instCheckTime datetime,@instCheckType varchar(1),@instUserId int,@instMaxDate datetime,@instMinDate datetime,@bln bit
select @instCheckTime=max(CheckTime) from inserted
select @instCheckType=max(CheckType) from inserted
select @instUserId=max(userid) from inserted
set @instMaxDate=dateadd(mi,5,@instCheckTime)
set @instMinDate=dateadd(mi,-5,@instCheckTime)
if not (@instCheckType='I' or @instCheckType='O')
begin
commit transaction
end
else
if (@instCheckType='I' or @instCheckType='O')
begin
if exists(select * from CheckInOut where userid=@instUserId and checktype=@instCheckType and checktime>@instMinDate and checktime<@instMaxDate)
begin
print @instCheckType
rollback transaction
end
else
if not exists(select * from CheckInOut where userid=@instUserId and checktype=@instCheckType and checktime>@instMinDate and checktime<@instMaxDate)
begin
commit transaction
end
end
begin transaction