Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Getting the type of database object.Table/Function

Author  Topic 

Swati Jain
Posting Yak Master

139 Posts

Posted - 2007-04-30 : 11:10:01

Hello All,

My Database constists of large number of tables,views,functions

I know a database object but i dont know the whether its a table , view or function ,Is there any facility in sql server 2005 such that
I will get the type of the database object?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-30 : 11:12:56
Make Use of OBJECTPROPERTY() function.

For example,

SELECT OBJECTPROPERTY(OBJECT_ID('XYZ'), 'IsProcedure')
SELECT OBJECTPROPERTY(OBJECT_ID('XYZ'), 'IsUserTable')
SELECT OBJECTPROPERTY(OBJECT_ID('XYZ'), 'IsScalarFunction')


Check documentation for more options.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-30 : 11:13:02
[code]select type, type_desc from sys.objects where name = '<object name>'[/code]


KH

Go to Top of Page
   

- Advertisement -