Monday, March 12, 2012

Get the owner of a table in SQLServer

Is there any way to get the owner of a table or a database object in SQL
Server? I want to check whether a given user id is the owner of a particular
table or not.
Please help me with an example if possible.
VenkatVenkat
SELECT ROUTINE_NAME,ROUTINE_SCHEMA
FROM INFORMATION_SCHEMA.ROUTINES
WHERE OBJECTPROPERTY(OBJECT_ID(ROUTINE_SCHEMA+
'.'+ROUTINE_NAME),
'IsMsShipped')=0
"Venkat" <tammana@.inooga.com> wrote in message
news:eDZqMy%23mFHA.3304@.tk2msftngp13.phx.gbl...
> Is there any way to get the owner of a table or a database object in SQL
> Server? I want to check whether a given user id is the owner of a
> particular table or not.
> Please help me with an example if possible.
> --
> Venkat
>|||VENKAT,
Execute the below system stored procedure
sp_help <object_name>
Execute the sp_help with out parameter to get the object owners for all
objects.
Thanks
Hari
SQL Server Mvp
"Venkat" <tammana@.inooga.com> wrote in message
news:eDZqMy%23mFHA.3304@.tk2msftngp13.phx.gbl...
> Is there any way to get the owner of a table or a database object in SQL
> Server? I want to check whether a given user id is the owner of a
> particular table or not.
> Please help me with an example if possible.
> --
> Venkat
>

No comments:

Post a Comment