ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Insert Statment with FIELNNAME as Column name

Post new topic  Reply to topic
 Insert Statment with FIELNNAME as Column name « View previous topic :: View next topic » 
Author Message
sebwerner
PostPosted: Wed Jul 03, 2013 10:09 am    Post subject: Insert Statment with FIELNNAME as Column name Reply with quote

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
View user's profile Send private message
lancelotlinc
PostPosted: Wed Jul 03, 2013 10:27 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Wed Jul 03, 2013 1:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Insert Statment with FIELNNAME as Column name
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.