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

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 variable tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-11-03 : 08:06:43
Vinod writes "hai sql team,

i am using variable tables inside stored proc.
suppose i want to get some data from two or three tables.

does variable tables performs better than inner joins?
now i am declaring a variable table
eg: declare @Temp table(a,b,c,d)

and inserting the records from other tables into @Temp

finally selecting the @Temp as result of stored proc

please help me yar....
i am really confused which one to use....

advance thanx.....vinod"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-11-03 : 08:23:34
When you tested which approach was better, what were the results? What was your testing approach?

Jay White
Go to Top of Page

sqldba2k6
Posting Yak Master

176 Posts

Posted - 2006-11-03 : 13:53:45
usage of table variables in the stored procedures will give you better performance than inner joins!
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-11-03 : 14:10:01
That is a bold statement. Care to share with us how you came to that conclusion?

Jay White
Go to Top of Page

sqldba2k6
Posting Yak Master

176 Posts

Posted - 2006-11-03 : 14:27:58
I was also facing a similiar performance issues which my stored procedures contains more joins with multiple table.
Since i tried many ways to figured out the issue and finally when i rewrite my stored procedure with the table variables.

I found the performance of application with new stored procedure was drastically improved.


Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2006-11-03 : 14:36:05
Can you share any more details with us? If I need data from 3 tables to generate a rowset, how can I use a table variable to improve performance? Can you give an example?

Jay White
Go to Top of Page
   

- Advertisement -