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.
Category: Keywords, Microsoft SQL Server, SQLServerPedia Syndication, T-SQL | Tags: code language, language sql, microsoft sql server, object functions, object id, property functions, sql statements, system functions, T-SQL
3 thoughts on “IsMSShipped”
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
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.
Good.. this what I was looking for
Glad to hear it. It’s come in handy for me too.