我要完成我的任务,但我遇到了一些问题,所以我需要你的帮助我已经创建了一个表名客户端包含 6 列名称(c_id,c_name,c_transfer,c_balance,day,time)现在任务是我必须创建一个触发器,其中日期列包含 Satauarday 和星期日,它会打印对不起银行关闭,如果时间列包含 05:00 到 09:00,它将插入,但如果时间没有重新保护条件行不能插入。代码如下:
create table client
(
c_id int identity primary key,
c_name varchar(50),
c_transfer money,
c_balance money,
[date] datetime,
[day] varchar(50),
)
alter trigger transactions
ON client
for Insert
as
begin
if(select top 1 [day] from client order by c_id desc)='Satuarday'
begin
print'Sorry Bank is closed today'
rollback;
commit;
end
if(select top 1 [day] from client order by c_id desc)= 'Sunday'
begin
print'Sorry Bank is closed today'
rollback;
commit;
end
if(select top 1 date from client order by c_id desc)not in (DATEDIFF(hh,'09:00','05:00'))
begin
print'Sorry Bank time is not this...'
rollback;
commit;
end
end