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.
| Author |
Topic |
|
aidmondo
Starting Member
23 Posts |
Posted - 2012-05-28 : 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 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2012-05-28 : 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
52326 Posts |
Posted - 2012-05-28 : 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=175143why cant you apply the same here?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|