What are the differences between stored procedure and
functions in SQL Server 2000?
Answer Posted / aashish
In many instances you can accomplish the same task using either a stored procedure or a function. Both functions and stored procedures can be custom defined and part of any application. Functions, on the other hand, are designed to send their output to a query or T-SQL statement. For example, User Defined Functions (UDFs) can run an executable file from SQL SELECT or an action query, while Stored Procedures (SPROC) use EXECUTE or EXEC to run. Both are instantiated using CREATE FUNCTION.
To decide between using one of the two, keep in mind the fundamental difference between them: stored procedures are designed to return its output to the application. A UDF returns table variables, while a SPROC can't return a table variable although it can create a table. Another significant difference between them is that UDFs can't change the server environment or your operating system environment, while a SPROC can. Operationally, when T-SQL encounters an error the function stops, while T-SQL will ignore an error in a SPROC and proceed to the next statement in your code (provided you've included error handling support). You
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
What do you mean by authentication modes in sql server?
How to defragment table indexes?
Is sql server a database?
how can you find out if the current user is a member of the specified microsoft® windows nt® group or microsoft sql server™ role? : Sql server administration
Mention the command used to rename the database.
what is a live lock? : Sql server database administration
wat wil hapn if we give the both read and deny read permission to user?
What is difference between order by and group by?
What is temporal data type?
How do you create a data source?
How do you open a cluster administrator?
I have triggers,views,functions,stored Procedures for a table. When I am dropping that table which objects are deleted?
What is an indexing strategy?
Write a sql query to sort on different column name according to the parameters passed in the function?
How to select all columns of all rows from a table with a select statement in ms sql server?