Saturday, March 21, 2009

System Sp's Used in SQL server

SP's are Precompiled T-SQL statement that are stored on the server .SQL server supplies a group pf SP's collectively called system SP.By using these SP's we can easily and quickly access,update, andmaintain inforamtion that is stored in sytem tables.These stored Procedure Start with sp_
Few of them are as fallows, these can be very useful for getting information while working with SQL server.
1)sp_help:This sp is used to get information about a DBobject which is any object listed in sysobject table or user defined datatype
i)sp_help give information about the object of current DB
ii)in case no parameter it gives information about all the objects in current DB.
syntax: sp_help objname
2)sp_helpDB:This gives information about a specified DB or all theDB's Present in the server
syntax: sp_helpdb objname
in case no parameter it gives information about all the DB's
3)sp_helpSql:very useful sp while working on sql ,it give u help on some topic in otherwords it can give you T-sql statement of some topic e.g. datatype,expression or text function
i) you must include quotation marks around topic parameter
ii)you can enter just few letters of a particular topic to identify it then help on the specified topic is displayed.
syntax: sp_helpsql 'create tablename'
4)sp_who:This reports information about a specific use,a specified SQL server process,all currently running process or all active process
This can be very useful while troubleshooting sql server or when u are facing performence issues with server.
syntax: sp_who

No comments:

Post a Comment