This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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


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


Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You can use variables as object names I think. Try using sp_sqlexec with your dynamic statement instead.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Create procedure for inserting record into table : Table name dynamically as an Param
 
It's not a secret anymore!