Thursday, October 14, 2010

Sql - Function Vs Stored Procedure

Functions

1. Can be used with Select statement.
2. Not returns output parameter but returns table variables.
3. You can join UDFs.
4. Can not be used to change server configuration.
5. Can not be used with XML FOR clause.
6. Can not have transaction within function.


Stored Procedures

1. Used with EXEC or EXECUTE.
2. Returns output parameter.
3. You can not join SPs.
4. Can be used to change server configuration.
5. Can be used with XML FOR Clause.
6. Can have transaction within SP.

No comments:

Post a Comment

Node | Cluster Vs Worker Threads

Cluster: Multiple processes (scale app across CPU cores) Worker Threads: Multiple threads (handle CPU-heavy work inside one process) Cluster...