Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Table Variable to Update Table

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
I'm thinking of passing a table variable to a stored procedure instead of code like the following and the number of columns could be more than shown here.
Code:
@invoicenbr varchar(10)
,@invoicedate smalldatetime
,@duedate smalldatetime
,@invoicestatus int
,@leasemasterfk int
...
UPDATE dbo.InvoiceMaster SET
invoicenbr = @invoicenbr
,invoicedate = @invoicedate
,duedate = @duedate
,invoicestatus = @invoicestatus
,leasemasterfk = @leasemasterfk
...
The table variable would have all of the required fields and have only one record.
This would eliminate passing the variables one by one, but I worry that this is might really slow it down.
Speed is not real important for this app, but don't want it to be slow either.
Also it's a real pain to drop and recreate all of the procedures that use the table variable every time I change the table variable.
Any guidance would be appreciated.


Auguy
Sylvania/Toledo Ohio
 
Thanks Borislav,
I've created some procedures that pass a table as a parameter and they work OK.
Is there any way to get around dropping and recreating any stored procedures that use the table when the table being passed structure is changed?

Auguy
Sylvania/Toledo Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top