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
 Database Design and Application Architecture
 structure table for payment

Author  Topic 

programer
Posting Yak Master

221 Posts

Posted - 2011-06-04 : 18:35:22
I have a table tbl_payment and tblPaymentDetails.

In the tbl_Payment I have:
ID | PaymentMethod
1 | Visa
2 Mastercard
3 PayPal


in the tbl_PaymentDetails I have:
ID | IDPaymentMethod | AttributeName
1 | 1 | CardNumber
2 | 1 | CardName
3 | 2 | CardNumber
4 | 3 | email


in the tbl_transactions I have:
ID | ReferenceNumber | TransactionMethod| Amount
1 | 4324242 | Visa | 10
2 | dasda3 | Mastercard | 30
3 | dasd23 | PayPal | 100

Up to here everything is clear.


In the column AttributeName I can not to added "Amount", because column AttributeName is Data Type varchar. Amount is DataType= decimal.

I was thinking that in the column AttributeName in the table tbl_PaymentDetails, add ReferenceNumber. Thus I get data of Payment details and amount payment.



Do you have a better idea ?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-06-05 : 03:54:20
make AttributeName of sql_variant type if you want to store numeric data also

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -