aspose file tools*
The moose likes JDBC and the fly likes Create procedure for inserting record into table : Table name dynamically as an Param Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Create procedure for inserting record into table : Table name dynamically as an Param" Watch "Create procedure for inserting record into table : Table name dynamically as an Param" New topic
Author

Create procedure for inserting record into table : Table name dynamically as an Param

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 757
Hi I am trying to create a procedure which will insert record in to one table but for inserting record i need to specify table name dynamically which will come as input parameter to my procedure.

i have written the following procedure for the same


Error Stack Trace


Can anybody help me out with this. thats the issue. i am declaring the tableName variable but its still showing the error.

I am using MS SQL Server 2000.

Thanks & Regards,
Jigar Naik


Jigar Naik


Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1134

Jigar,
You cannot use a parameter in place of a table name.
You must replace the parameter with the actual table name before you send the INSERT statement to the database.
Perhaps consider using class "java.text.MessageFormat"?

Good Luck,
Avi.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You don't have access to MessageFormat in Transact-SQL. See your other post for a way of doing this.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
Don't get me started about those stupid light bulbs.
 
subject: Create procedure for inserting record into table : Table name dynamically as an Param