IsMSShipped

3

January 23, 2013 by Kenneth Fisher

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.

About these ads

3 thoughts on “IsMSShipped

  1. sqlpathy says:

    Good one. Though I have been using Object Property function for some time now. But i was not aware of this property. Thanks for sharing.

  2. Anupam says:

    Good.. this what I was looking for

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 338 other followers

%d bloggers like this: