有错误,按照你原来的写法,“m_date-now<0”,应该改成:create trigger m_update
on 课程信息表 for update
as
if exists (select 1 form inserted where m_date<getdate())
begin
ROLLBACK TRANSACTION
print '不能修改 '
end
go但我估计你的愿意是只能修改当天数据,所以应该是:create trigger m_update
on 课程信息表 for update
as
if exists (select 1 form inserted where m_date<convert(datetime,convert(char(8),getdate(),113)))
begin
ROLLBACK TRANSACTION
print '不能修改 '
end
go
on 课程信息表 for update
as
if exists (select 1 form inserted where m_date<getdate())
begin
ROLLBACK TRANSACTION
print '不能修改 '
end
go但我估计你的愿意是只能修改当天数据,所以应该是:create trigger m_update
on 课程信息表 for update
as
if exists (select 1 form inserted where m_date<convert(datetime,convert(char(8),getdate(),113)))
begin
ROLLBACK TRANSACTION
print '不能修改 '
end
go
改为:create trigger m_update
on 课程信息表 for update
as
if exists (select 1 form inserted where m_date<convert(datetime,convert(char(8),getdate(),112)))
begin
ROLLBACK TRANSACTION
print '不能修改 '
end
go