Search code examples
sql-serversql-server-2008stored-procedures

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?


Solution

  • 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_