Blog Post

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.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating