Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Owner of objects in Database
 

Owner of objects in Database

In database properties there is in General property Name and Owner. I’m trying to get that with SQL Query. Is it possible?

With this query I got name of objects in database, and schema name (is it sys or dbo).

SELECT sys.objects.name, sys.schemas.name AS schema_name

FROM sys.objects

INNER JOIN sys.schemas ON sys.objects.schema_id = sys.schemas.schema_id

But how can I get the name of developer who create that object?


Nensy V.
Nensy V_  Monday, September 14, 2009 8:18 AM

Hi Nensy V_,

The sql script below shows how to get the name and the owner of the current database:
--Get the name of the current database.

select DB_NAME() as dbName;

--Get the owner of the current database.

select SUSER_SNAME(owner_sid) as dbOwner from sys.databases where name=DB_NAME();

Let me know if this does not help.
Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
  • Marked As Answer byNensy V_ Thursday, September 17, 2009 6:03 AM
  •  
Aland Li  Wednesday, September 16, 2009 6:16 AM

Hi Nensy V_,

The sql script below shows how to get the name and the owner of the current database:
--Get the name of the current database.

select DB_NAME() as dbName;

--Get the owner of the current database.

select SUSER_SNAME(owner_sid) as dbOwner from sys.databases where name=DB_NAME();

Let me know if this does not help.
Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
  • Marked As Answer byNensy V_ Thursday, September 17, 2009 6:03 AM
  •  
Aland Li  Wednesday, September 16, 2009 6:16 AM

You can use google to search for other answers

Custom Search

More Threads

• DataGridViewComboBoxCell values depending on another DataGridViewComboBoxCell
• Binding a dropdownlist using EntLib and OOP
• How to update dataset
• adding new data to the master/detail form
• Update Null from a TextBox
• vb.net datagridview
• Connecting to MySQL Views: Unknown SQL Type
• DataGridView and default SortMode
• Datagridview on datagridview
• Binding DataGridView to a DataTable - skipping binding some of the columns in the DataTable