| Author |
Specifying Table Name Dynamically in Insert Statement....
|
Jigar Naik
Ranch Hand
Joined: Dec 12, 2006
Posts: 744
|
|
Can i specify table name dynamically in insert statement ? as follows...
|
Jigar Naik
|
 |
Scott Selikoff
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3652
|
|
|
Yeah, why wouldn't you be able to? For the most part, JDBC does not validate or even understand the SQL you send to the database server other than its just a SQL String.
|
My Blog: Down Home Country Coding with Scott Selikoff
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26193
|
|
Jigar, Yes, you can build a Statement's SQL through String concatenation. Note that you cannot write "insert into table ? ..." in a PreparedStatement though.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Muhammad Saifuddin
Ranch Hand
Joined: Dec 06, 2005
Posts: 1318
|
|
Originally posted by Scott Selikoff: JDBC does not validate or even understand the SQL you send to the database server other than its just a SQL String.
Nice clarification Scott, I really appreciated your knowledge..
|
Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
|
 |
 |
|
|
subject: Specifying Table Name Dynamically in Insert Statement....
|
|
|