| Author |
Topic  |
|
|
aidmondo
Starting Member
Ghana
23 Posts |
Posted - 05/28/2012 : 07:14:25
|
Create table PaymentMethods( PaymentMethodID int Primary Key, Description not null ) The Descriotion is either cheque, cash or CreditCard.
Create table Payments( PaymentID int Primary Key, PaymentMenthodID int Constraint cfkPay Foreign Key References (#above) not null, CreditCardNo varchar(20), CardHoldersName varchar(50), ExpDate datetime,PaymentAmount money ) If the descriotion is creditcard, its details in the Payments table should be entered, if not the creditcard details should be left blank.
aidmondo |
Edited by - aidmondo on 05/28/2012 11:15:38
|
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29156 Posts |
Posted - 05/28/2012 : 07:21:28
|
You don't need a trigger for this. You need a CHECK CONSTRAINT.
N 56°04'39.26" E 12°55'05.63" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
48076 Posts |
Posted - 05/28/2012 : 13:54:25
|
quote: Originally posted by aidmondo
Create table PaymentMethods( PaymentMethodID int Primary Key, Description not null ) The Descriotion is either cheque, cash or CreditCard.
Create table Payments( PaymentID int Primary Key, PaymentMenthodID int Constraint cfkPay Foreign Key References (#above) not null, CreditCardNo varchar(20), CardHoldersName varchar(50), ExpDate datetime,PaymentAmount money ) If the descriotion is creditcard, its details in the Payments table should be entered, if not the creditcard details should be left blank.
aidmondo
didnt i give you similar solution here?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=175143
why cant you apply the same here?
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
| |
Topic  |
|
|
|