Hello everyone,
I am hoping you can help with this. Below is a table in our database called PaymentTransaction. One of the columns is a varchar(2000) that contains a string that contains data from a payment transaction from an outside source. This table records a parents payment to their children's account for school lunch. Each payment is shown in one row in the table. The field 'amount' is the total dollars that the parent submitted. How that total gets divided up to their children is shown in the column userDataXML. "PaymenttransactionState persons=" shows the internal personid of the child they put payment to (The personid is a key field to other tables in the database). "foodamounts=" shows the amount of dollars put toward each child. In some cases their may be one, two, three or more children that they are making payments toward.
Here is what the tabe and some of the data looks like:
PaymentTransaction table
paymentTransactionID int
transactionRef int
paymentID int
paymentTimestamp datetime
requestID varchar(100)
paymentUserAccountID int
paymentMethodRef_dep2011M int
amount decimal(7, 2)
convenienceFee decimal(6, 2)
transactionFee decimal(6, 2)
paymentTransactionStateID int
modifiedTimestamp datetime
modifiedBy int
userDataXML varchar(2000)
comments varchar(500)
paymentMethodReferenceID int
originalTransactionID int
Below is data extracted from the PaymentTransaction table
1 111111111 1 2015-08-12 12:04:50.637 3233333333333 1 NULL 5.00 2.75 0.62 2 NULL 20791 <PaymentTransactionState persons="163" accounts="1116" assignments="" feeamounts="" foodamounts="5.00" convenienceFee="2.75" > NULL 1 NULL
6 222222222 6 2015-08-20 19:26:32.873 1234567890000 6 NULL 40.00 2.75 1.85 2 NULL 22455 <PaymentTransactionState persons="6141,2116" accounts="2037,2036" assignments="" feeamounts="" foodamounts="20.00,20.00" convenienceFee="2.75"> NULL 5 NULL
9 222222222 6 2015-08-20 19:26:32.873 1234567890000 6 NULL 60.00 2.75 1.85 2 NULL 22455 <PaymentTransactionState persons="1234,56787,1357" accounts="1111,2036,1245" assignments="" feeamounts="" foodamounts="25.00,15.00,20.00" convenienceFee="2.75"> NULL 5 NULL
What I need to do is to get the above data in a table (NewTable) in a format that I can join to other tables to create a report.
NewTable
paymenttransactionid int,
paymentdate datetime,
personid int,
Amount decimal(7,2))
Data would look like this
1 2015-08-12 12:04 163 5.00
6 2015-08-20 19:26 6141 20.00
6 2015-08-20 19:26 2116 20.00
9 2015-08-20 19:26 1234 25.00
9 2015-08-20 19:26 56787 15.00
9 2015-08-20 19:26 1357 20.00
I do not know how to break out the data in the column userdataXML to accomplish this.
I appreciate any help you can give me on this
Thank you
I am hoping you can help with this. Below is a table in our database called PaymentTransaction. One of the columns is a varchar(2000) that contains a string that contains data from a payment transaction from an outside source. This table records a parents payment to their children's account for school lunch. Each payment is shown in one row in the table. The field 'amount' is the total dollars that the parent submitted. How that total gets divided up to their children is shown in the column userDataXML. "PaymenttransactionState persons=" shows the internal personid of the child they put payment to (The personid is a key field to other tables in the database). "foodamounts=" shows the amount of dollars put toward each child. In some cases their may be one, two, three or more children that they are making payments toward.
Here is what the tabe and some of the data looks like:
PaymentTransaction table
paymentTransactionID int
transactionRef int
paymentID int
paymentTimestamp datetime
requestID varchar(100)
paymentUserAccountID int
paymentMethodRef_dep2011M int
amount decimal(7, 2)
convenienceFee decimal(6, 2)
transactionFee decimal(6, 2)
paymentTransactionStateID int
modifiedTimestamp datetime
modifiedBy int
userDataXML varchar(2000)
comments varchar(500)
paymentMethodReferenceID int
originalTransactionID int
Below is data extracted from the PaymentTransaction table
1 111111111 1 2015-08-12 12:04:50.637 3233333333333 1 NULL 5.00 2.75 0.62 2 NULL 20791 <PaymentTransactionState persons="163" accounts="1116" assignments="" feeamounts="" foodamounts="5.00" convenienceFee="2.75" > NULL 1 NULL
6 222222222 6 2015-08-20 19:26:32.873 1234567890000 6 NULL 40.00 2.75 1.85 2 NULL 22455 <PaymentTransactionState persons="6141,2116" accounts="2037,2036" assignments="" feeamounts="" foodamounts="20.00,20.00" convenienceFee="2.75"> NULL 5 NULL
9 222222222 6 2015-08-20 19:26:32.873 1234567890000 6 NULL 60.00 2.75 1.85 2 NULL 22455 <PaymentTransactionState persons="1234,56787,1357" accounts="1111,2036,1245" assignments="" feeamounts="" foodamounts="25.00,15.00,20.00" convenienceFee="2.75"> NULL 5 NULL
What I need to do is to get the above data in a table (NewTable) in a format that I can join to other tables to create a report.
NewTable
paymenttransactionid int,
paymentdate datetime,
personid int,
Amount decimal(7,2))
Data would look like this
1 2015-08-12 12:04 163 5.00
6 2015-08-20 19:26 6141 20.00
6 2015-08-20 19:26 2116 20.00
9 2015-08-20 19:26 1234 25.00
9 2015-08-20 19:26 56787 15.00
9 2015-08-20 19:26 1357 20.00
I do not know how to break out the data in the column userdataXML to accomplish this.
I appreciate any help you can give me on this
Thank you