• Post Reply Bookmark Topic Watch Topic
  • New Topic

Fetching data using jdbc....query doubt

 
Rajesh Agarwal
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone help me out with the following query.

Insert into employee select 'rajesh',age,sex from xyz.

The thing is I am trying to insert into employee table the values from zyz table. in future incase a new column is added to xyz table, then I have to manually add to this query.

I need a solution where I need to hardcode 'rajesh in first column and select all other column names from xyz and insert into employee.
 
Maximilian Xavier Stocker
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rajesh Agarwal:
can someone help me out with the following query.

Insert into employee select 'rajesh',age,sex from xyz.

The thing is I am trying to insert into employee table the values from zyz table. in future incase a new column is added to xyz table, then I have to manually add to this query.

I need a solution where I need to hardcode 'rajesh in first column and select all other column names from xyz and insert into employee.


Did you try
 
Rajesh Agarwal
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is syntactically wrong
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try it?
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!