e enjte, 14 qershor 2007

Session 16

1. Create trigger InsertSales on sales
for insert
AS
if ((select ord_date from inserted)<10)>=10'
rollback tran
end

-- Kiem tra trigger
Insert into dbo.sales values ('6380', '0001', '10/01/2006', 10, 'Net 6','BU1032' )

2. Create trigger UpdatetitleAdvance on dbo.titles
for update
AS
if ((select advance from inserted)>15000)
begin
print 'Advance khong the lon hon 15000'
rollback tran
end

-- Kiem tra trigger
update dbo.titles set advance=20000 where title_id='BU1032'

3. sp_helptext InsertSales

4. Alter trigger UpdatetitleAdvance on dbo.titles with encryption
for update
AS
if ((select advance from inserted)>15000)
begin
print 'Advance khong the lon hon 15000'
rollback tran
end

Nuk ka komente: