Search Here

Thursday, January 21, 2010

Difference b/w Stored Procedure and UDF

1. You can use SELECT statement with UDF, while either EXEC or Exec can be used with SP.
2. A UDF can return a Table variable, while with SP you can create a table but can't return a table variable.
3. You can write Update, Delete statements within the SP, but UDF does not allow this.
4. You can use UDF in a JOIN, but SP can not be used.
5. You can write your queries within the transaction in SP but UDF does not allow you to write the queries within the transactions.

No comments:

Post a Comment