Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 trigger programming problem

Author  Topic 

mcbtiger
Starting Member

4 Posts

Posted - 2010-05-13 : 14:25:03
Hello

I have same problem to create trigger i create two tables 1) is Cusotmer profiles and 2)Customer Buy

1) Customer profile table consist 4 fields
CustomerID CustomerName CustomerBalance Status
02 Jack 4500 Disable




2) CustmerID Producet Qty TotalAmount
02 Fish 4 350
02 Oil 1 150


i want to create trigger that if Customer profile status field is (Disable).block insert new enter in CustomerBuy table where CustomerID 02

create trigger block on CustomerBuy
for insert
as
if insert(CustomerBuy.Client)
begin
if exists (select status from inserted where status='Enable')
rollback
end

Muhammadali

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-05-13 : 15:48:34
Can you explain this a little bit?
quote:
block insert new enter in CustomerBuy table where CustomerID 02


Not exactly clear with the requirement.
Go to Top of Page
   

- Advertisement -