| Author | 
		  Message
		 | 
		
		  | Aradhana | 
		  
		    
			  
				 Posted: Wed Jun 16, 2004 6:16 am    Post subject: Problem with insert statement in ESQL | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 16 Jun 2004 Posts: 2
  
  | 
		  
		    
			  
				Hi,
 
 
I have written esql as "INSERT INTO Database.TABLE1 VALUES(SELECT T.* FROM Database.TABLE2 T)"  in Compute node. Its not showing any syntax error in esql but its giving error bcoz of this statement while deployment.
 
 
Kindly suggest.
 
 
Thanks and Regards
 
Aradhana | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Wed Jun 16, 2004 6:24 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				You need to always qualify your databases with correlation names using the 'AS' clause. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Aradhana | 
		  
		    
			  
				 Posted: Wed Jun 16, 2004 6:22 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 16 Jun 2004 Posts: 2
  
  | 
		  
		    
			  
				sorry i missed 'AS' ,now the esql is 
 
INSERT INTO Database.MGCCJRNB VALUES(SELECT T.* FROM Database.MGCCJRNL AS T );
 
 
But still its giving error while deploying .... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fazz | 
		  
		    
			  
				 Posted: Thu Jun 17, 2004 12:04 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Centurion
 
 Joined: 20 Feb 2004 Posts: 144 Location: England 
  | 
		  
		    
			  
				Shouldn't this....
 
 
   
	| Quote: | 
   
  
	| INSERT INTO Database.MGCCJRNB VALUES(SELECT T.* FROM Database.MGCCJRNL AS T );  | 
   
 
 
 
be this....
 
 
INSERT INTO Database.MGCCJRNB(COLNAME) VALUES(SELECT T.* FROM Database.MGCCJRNL AS T ); | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqsidude | 
		  
		    
			  
				 Posted: Thu Jun 17, 2004 2:25 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Centurion
 
 Joined: 22 Jan 2004 Posts: 148
  
  | 
		  
		    
			  
				| The stmt "SELECT T.* FROM Database.MGCCJRNL AS T" will always return a list (array) of values. You have to capture them into a variable array first and then insert them in a different INSERT stmt. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Thu Jun 17, 2004 2:36 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				
   
	| mqsidude wrote: | 
   
  
	| The stmt "SELECT T.* FROM Database.MGCCJRNL AS T" will always return a list (array) of values. You have to capture them into a variable array first and then insert them in a different INSERT stmt. | 
   
 
 
Not necessarily.
 
 
   
	| Aradhana wrote: | 
   
  
	sorry i missed 'AS' ,now the esql is
 
INSERT INTO Database.MGCCJRNB VALUES(SELECT T.* FROM Database.MGCCJRNL AS T );
 
 
But still its giving error while deploying .... | 
   
 
 
Please review the documentation for the ESQL statement "Insert".  It's not the same as a regular SQL Insert statement. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kirani | 
		  
		    
			  
				 Posted: Thu Jun 17, 2004 10:58 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Jedi Knight
 
 Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA 
  | 
		  
		    
			  
				Use the PASSTHRU command instead. _________________ Kiran
 
 
 
IBM Cert. Solution Designer & System Administrator - WBIMB V5
 
IBM Cert. Solutions Expert - WMQI
 
IBM Cert. Specialist - WMQI, MQSeries
 
IBM Cert. Developer - MQSeries
 
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mgk | 
		  
		    
			  
				 Posted: Mon Jun 21, 2004 5:40 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Padawan
 
 Joined: 31 Jul 2003 Posts: 1647
  
  | 
		  
		    
			  
				You cannot currently INSERT a list (the return from a SELECT in your case). You have to do this in two stages (SELECT into a tree then INSERT individual columns) or use passthru as suggested above.
 
 
Regards, _________________ MGK
 
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |