|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Insert Statment with FIELNNAME as Column name |
« View previous topic :: View next topic » |
Author |
Message
|
sebwerner |
Posted: Wed Jul 03, 2013 10:09 am Post subject: Insert Statment with FIELNNAME as Column name |
|
|
Newbie
Joined: 02 Jul 2013 Posts: 7
|
Hi,
i have the following JSON string as data:
Code: |
{"Name" : "DecisionReasons" ,
"DecisionReason" :[
{
"Code" : "RA02",
"Description" : "By Committee"
}]} |
and would like to create the following INSERT statement
Code: |
DECLARE table REFERENCE TO InputRoot.JSON.Data;
INSERT INTO Database.{table.name}(FIELDNAME(table.DecisionReasons.Code),FIELDNAME(table.DecisionReasons.Description) VALUES (table.DecisionReasons.Code,table.DecisionReasons.Description) |
Everything works except the dynamic column names. Is it possible to use dynamic column names with the INSERT statement. And if so How?
Thanks a lot for your help |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jul 03, 2013 10:27 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
What document in the product documentation leads you to 'FIELDNAME' as a solution?
Have you studied about 'PASSTHRU'?
Did you attend the required nine days of training? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jul 03, 2013 1:04 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
FIELDNAME returns the name of the field.
You're trying to insert a message into a database table without knowing what the columns of the table are at development time?
Really? Why? What happens if the message contains a field that doesn't have a column in the database of the same name? Why is that an acceptable risk?
I think you are trying too hard to make your code general purpose, and will end up with a solution that is unreliable and hard to maintain. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|