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 Java 8 in Action this week in the Java 8 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: 751
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Create procedure for inserting record into table : Table name dynamically as an Param
 
Similar Threads
WITHOUT STORED PROCEDUREs
Stored Procedure problem
procedure return resultset
Create procedure for inserting record into table : Table name dynamically as an Param
INSERT INTO SELECT FROM