This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 761
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: 1138
    
    1

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create procedure for inserting record into table : Table name dynamically as an Param
 
It's not a secret anymore!