Stored Procedure (SP) | Function (User Defined Function - UDF) | |
---|---|---|
SPs are pre-compile objects which are compiled for first time and its compiled format is saved which executes (compiled code) whenever it is called | Functions are compiled and executed every time when it is called | |
SP can return zero, single or multiple values | Function should return atleast one value | |
We can use Transactions in SP | Cannot use transactions in UDF | |
SPs can use SELECT, UPDATE, INSERT, DELETE, DROP statements | Functions are computed values and only SELECT statement is valid | |
SPs cannot be utilised in SELECT statements | Functions can be embedded in SELECT statement | |
SP can have input and output parameter | UDFs can have only input parameters | |
SPs can can execute with or without parameters | UDFs needs at least one input parameter. Without parameter UDFs can be created but it would be a insignificant one | |
We call function from SP | We cannot call SP from an UDF | |
Exception handlers like TRY-CATCH blocks can be used in SP | Cannot use Exception handlers can be used in UDF |
- SQL Server
- T-SQL
- Searches
- Checks
- Check size of databases in SQL Server
- Check size of tables in a database
- Find Currently running queries
- Check all SQL Server instances
- Check Job execution status
- List all the triggers of a database
- List all Jobs in the SQL Server
- Check database(MDF) and Logfile(LDF) saved locations
- Find Identity, Increment, Seed values and column name of all tables in a database
- If
- DynamicSQL
- Renames
- SET Statements
- MS Office
- CTE
- Nth findings
- Differences1
- Differences2
- GoodOne
- UDFs
- DBAdministraton
- SSIS
- SSRS
- SSAS
- Definitions
- MS Access
- Useful VBA Functions
- Create Autonumber ID field VBA script
- Field Exists check
- Capture counts in a column MS Access
- Hide columns with Access VBA
- Execute SSIS dtsx package from Access vba
- Drop table if exists
- Export data to Existing Excel Sheet
- Export excel from MS Access and perform Formatting
- Extract number after a specific word from a full length string
- Extracts
- VBA
- Connections
- Useful VBA Functions
- MS Excel
- Tech
- Contact
Difference between Stored Procedures and Functions
Labels:
Difference,
Function,
SQL Server,
Stored Procedure
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment