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

CI/CD - Safe DB Changes/Migrations

Safe DB Migrations means updating your database schema without breaking the running application and without downtime . In real systems (A...