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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 problem with a trigger statement

Author  Topic 

raymon2683
Starting Member

5 Posts

Posted - 2005-11-30 : 06:57:03
hi
i have a table this is it:
CREATE TABLE Payments (

vPaymentId varchar(50) not NULL ,
iPaymentAmount int NOT NULL
CHECK (iPaymentAmount > 0),
dPaymentDate Datetime DEFAULT getdate(),
iCreditCardNumber int NULL,
cCardHolderName char(50) NULL,
dCreditCardExpDate datetime NULL,
vPaymentMethodId varchar(25)not NULL foreign key references Payment_Methods (vPaymentMethodId ),
cEventId int not null foreign key references Events (cEventId),
iFeeScheduleId int not null foreign key references
Fee_Schedules(iFeeScheduleId),
PRIMARY KEY (vPaymentId)
)
iwant to createa trigger on insert in that table if the vPaymentMethodId is 'Credit card', that will check if some value are entered in the 3 null column(iCreditCardNumber,cCardHolderName,dCreditCardExpDate ).
if the value match the properties the insert should happen else rollback and display a user define error.
but if the vPaymentMethodId is'Cash' these fields should remain blank.thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2005-11-30 : 07:06:55
duplicate post.
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=58392[/url]

-----------------
[KH]
Go to Top of Page
   

- Advertisement -