Tuesday, June 26, 2007

play with ms sql server sysobjects

play with ms sql server sysobjects
===========================


Sometimes you may want to see the list of all the objects within a database. This can be easily achieved.

SELECT * FROM master..sysobjects


This below query list out all the store procedure within a database :

SELECT * FROM master..sysobjects WHERE TYPE='P'

You may try out the other options:

SELECT * FROM master..sysobjects WHERE TYPE='U'

SELECT * FROM master..sysobjects WHERE TYPE='X'

You may list out some system functions:


SELECT LEFT(name, 30) FROM master..sysobjects WHERE LEFT(name, 3) = 'fn_'

No comments: