Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2007, 10:59 PM
Registered User
 
Join Date: Dec 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Difference between stored procedure and UDF

Can any body explain me difference between stored procedures and UDF

I know that we can use UDF in select statement but we can't use stored procedures in select statements

awaiting reply
Thanks

 
Old June 29th, 2007, 11:23 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

UDF == User Defined Function

The difference is, a stored procedure runs some query, a UDF however is used to process some value and return some value. Think of a SUM() or AVG() function, and you get the idea.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old June 30th, 2007, 12:35 AM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

To add to that... pretty sure a function cannot have an UPDATE or INSERT into a table other than a table variable created within the function... and it can't return result sets or results of PRINT's. Stored procedures can. Functions cannot use Temp tables... stored prcedures can. Pretty sure that functions cannot execute stored procedures... stored procedures can. Can't use SET commands in functions either.

Actually it's easier to say what a function can do with the understanding that everything else can't be done in a funtion. To find that info, curl up with BOL looking for "Functions, User Defined" for the full skinny.

--Jeff Moden





Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored procedure ashuphp MySQL 1 April 2nd, 2007 04:20 PM
stored procedure kdm260 SQL Server 2000 2 June 19th, 2006 04:45 PM
stored procedure keyvanjan Classic ASP Basics 2 May 26th, 2006 01:16 AM
Stored Procedure bmains SQL Server ASP 2 October 8th, 2004 03:19 AM
UDF and Stored Procedures hrishimusale SQL Server 2000 1 November 4th, 2003 12:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.