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
 Transact-SQL (2000)
 udf v/s stored procedure

Author  Topic 

Vishakha
Starting Member

40 Posts

Posted - 2006-05-30 : 08:07:11
I am working on a huge amount of data and I need to create reports.
I have 3 alternatives
alternative 1 --> Use stored procedures
approach
check if temp table exists,
if yes drop it
create one
execute the store proc logic.

logic includes nested stored procs

alternative 2 -->
Use nested UDFs and table variables to pass on the data
Parent UDF uses child UDF to get the data from the table variables

alternative 3
Use a mixture of store proc and UDF
Since UDF in a select clause is causes performance slowdown, will using UDFs within the store procedure help the cause.

Please let me know the following in terms of performance which is worse
1. creating and dropping of temporary tables as there will be many such instances
2. Calling nested table value UDFs.
3. Third alternative I am working on, still don't know more details on how to do it.

Thanks much for u'r help.

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-30 : 08:39:27
You shouldn't need to check for existance of a temp table - it will be dropped automatically when it's out of scope.
UDF's tend to be slower than most other things.

If you are using v2005 have a look at common table expressions - might help.
Without knowing what you are trying to do it's difficult to suggest a best approach.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-05-30 : 13:18:02
Read the hint link in my sig and post what its says



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page
   

- Advertisement -