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)
 stored proc between user-defined function

Author  Topic 

acdacd
Yak Posting Veteran

63 Posts

Posted - 2005-08-08 : 11:14:54
Hi all,

Until now, I am still not sure the difference between these two stuff.
It seems to me the most obvious difference is that
1. function can return table value
2. difficult for me to debug the function, for example, no print statement is allowed.

When I check the BOL, there are section called "Rewriting Stored Procedures as Functions". So I become more confused about how to choose and the time need to change between stored proc and function.

I have googled it, but it seem my question is DB dependent. Or any good reference ?

Thx

be a hardworking people!!

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-08-08 : 11:22:29
a function that returns a table can also be used in the FROM clause of your SELECT statement. This is usually why you would rewrite the stored proc as a function. It gives you more flexibility in using it.

btw, there is no hard and fast rule that tells you when to use what. Just try things out and do some testing. See which way works best for your solution and use it.



-ec

Go to Top of Page

acdacd
Yak Posting Veteran

63 Posts

Posted - 2005-08-09 : 11:34:16

I do think it is similar to arch design, no hard rule to deterimine to use user-defined function or stored proc.

Do other have any other opinion?
Or do you know any good doucment/book discuss this topic?

Thx

be a hardworking people!!
Go to Top of Page
   

- Advertisement -