SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

AskSQLTeam
Ask SQLTeam Question

USA
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.

akakar
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 (http://support.microsoft.com/support/kb/articles/Q296/6/42.ASP). 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.

Thanks

Go to Top of Page

robvolk
Most Valuable Yak

USA
15635 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:

http://www.sqlteam.com/item.asp?ItemID=4599
http://www.sqlteam.com/item.asp?ItemID=4619

Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.08 seconds. Powered By: Snitz Forums 2000