What is the basic difference between SQL Server stored procedures (sp_) and extended stored procedures (xp_)? Why there are extended procedures anyway?
Extended stored procedures are DLL files which are referenced by the SQL Server by having the extended stored procedure created which then reference functions or procedures within the DLL. The DLLs which are behind the extended stored procedures are typically created in a lower level language like C or C++.
Types of Stored ProceduresUser-defined Stored Procedures. System Stored Procedures.
Answers. 1) Procedure is a block of PL/SQL code , it never stored in database. and 3) Stored procedure is block of PL/SQL code it is named and stored within the database.
In a function, it is mandatory to use the RETURNS and RETURN arguments, whereas in a stored procedure is not necessary. In few words, a stored procedure is more flexible to write any code that you want, while functions have a rigid structure and functionality.
Extended stored procedures are written in c/c++(I believe anything that can create a DLL in native code), stored procedures are written in T-SQL
extended stored procedures exist because they allow you to do things that you cannot do in T-SQL like running DOS command (xp_cmdshell)
BTW do not name your procs starting with sp_..that is bad practice...see Don't start your procedures with SP_
An extended stored procedure executes code that is not SQL. It's normally written with external code like in C++.
Using Extended Stored Procedures
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With