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
 General SQL Server Forums
 New to SQL Server Programming
 declare table

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-12-02 : 23:26:27
Dear All,
actually, in our application, we are using so many temporary local variables like @table_name....

and based on these local variables, we are making joins with the regular adtabase tables. is it better thing instead of temp tables?

what exactly i want to know is,
@table_name,#temp_table,##temp_table.....
in these three processes, which one is the best one...

thanks in advance

Vinod
Even you learn 1%, Learn it with 100% confidence.

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-12-02 : 23:30:32
It depens on the purpose of the table. If you have only a few rows use @Table. Few hundred to thousands of rows use #Temp table. We rarely use ##Table. This is global temp table to be used across sessions.. So there are fundamental differences between the three. If you understand these differences you will know when to use which.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-12-03 : 00:02:06
thank you very much dinakar, and so many places, we are using 'in' is it ok or need to replace with exists?

i have confusion regarding in - exists, not in - not exists

which is the best option.....

Vinod
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-03 : 01:10:12
http://weblogs.sqlteam.com/mladenp/archive/2007/05/18/60210.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -