Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

SQLStudies

My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.

IsMSShipped

I just wanted to do a brief highlight of a handy little object property. For those of you who aren’t aware there are a handful of “property” functions available that can give you all sorts of information about your object, database etc. For example DATABASEPROPERTY, DATABASEPROPERTYEX, OBJECTPROPERTY, OBJECTPROPERTYEX, FILEPROPERTY etc.

In this particular case I’m looking at one of the properties available using OBJECTPROPERTY. IsMSShipped returns a 1 if the object was created during the installation of SQL Server.

So if you run the following code you will get back a list of all of the “user” objects in the AdventureWorks2008 database.

 USE AdventureWorks2008
GO

SELECT * FROM sys.objects
WHERE objectproperty(object_id,'IsMSShipped') = 0

And of course the reverse is true.

 USE AdventureWorks2008
GO

SELECT * FROM sys.objects
WHERE objectproperty(object_id,'IsMSShipped') = 1

This code returns all of the objects that were orriginally shipped with SQL Server.

I will agree that this isn’t the most useful property in the world for most people, but it does come in handy if you are the type of person (like me) who ends up querying the system object tables on a fairly regular basis.


Comments

Leave a comment on the original post [sqlstudies.com, opens in a new window]

Loading comments...