juur
juur

Reputation: 5723

Difference between stored procedures and extended stored procedures

What is the basic difference between SQL Server stored procedures (sp_) and extended stored procedures (xp_)? Why there are extended procedures anyway?

Upvotes: 8

Views: 7784

Answers (3)

Gourav Priyadarshi
Gourav Priyadarshi

Reputation: 1

A stored procedure is usually written in SQL or procedural extension like T-SQL, and it gets executed within the permission of the procedure owner. Whilst an extended stored procedure is a function written in an external programming language like C or C++. Which may not be as secure as a stored procedure as it is an external entity.

Upvotes: 0

kemiller2002
kemiller2002

Reputation: 115488

An extended stored procedure executes code that is not SQL. It's normally written with external code like in C++.

Using Extended Stored Procedures

Upvotes: 3

SQLMenace
SQLMenace

Reputation: 135011

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_

Upvotes: 11

Related Questions