Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Article: Stored Procedures: Parameters, Inserts and Updates
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ask SQLTeam Question

0 Posts

Posted - 02/20/2001 :  12:49:21  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
Darrell writes "I need to figure out how to run a query and get a recordset row. With the data from that recordset I need to create create a new row changing the primary key. The old row then needs to have status fields updated. I hope that is clear." I'll discuss passing parameters to stored procedures and using those parameters in SQL statements.

Article Link.

Starting Member

2 Posts

Posted - 11/16/2001 :  16:12:16  Show Profile  Reply with Quote
What if I need to perform an insert to a parameterized table name begin passed from the calling procedure? Apparently there is a substantial bug (IMHO) in SQL Server 2000 that prevents the use of a variablized table name ( Has anyone encountered this, and does anyone know any workarounds.

The only lame stopgap I came up with was to IF...ELSE every possible tableName and hardcode the tablename in the INSERT statement.


Go to Top of Page

Most Valuable Yak

15732 Posts

Posted - 11/16/2001 :  16:27:57  Show Profile  Visit robvolk's Homepage  Reply with Quote
That bug refers to table variables, not table names passed as a variable. If you are INSERTing rows into different tables, you need dynamic SQL. Take a look here:

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000