Solved

Details on SQL Server dbo and INFORMATION_SCHEMA

Posted on 2012-03-22
2
332 Views
Last Modified: 2012-04-10
Hi,
Can someone explain how dbo (database owner) works?  I have most tables under dbo but there are some which are under different user.

Also how can I use INFORMATION_SCHEMA to list details of tables,indexes ?

Thanks
0
Comment
Question by:crazywolf2010
2 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
Comment Utility
0
 
LVL 25

Accepted Solution

by:
jogos earned 500 total points
Comment Utility
<<Can someone explain how dbo (database owner) works?>>
There is a historical reason where you must be carefull when talking about dbo. There is the database owner as a role db_owner http://msdn.microsoft.com/en-us/library/ms189121(v=sql.90).aspx
and the dbo schema, the automatic default schema http://msdn.microsoft.com/en-us/library/ms190387.aspx

<<  I have most tables under dbo but there are some which are under different user.>>
Most tables under the schema dbo that's logic because it's the default
and some under a different schema not user, that was the historical part until it changed with version 2005.



<<Also how can I use INFORMATION_SCHEMA to list details of tables,indexes ?>>
Depends on what details you want

select * from informations_chema.tables
Select * from information_schema.columns
More info http://msdn.microsoft.com/en-us/library/ms186778.aspx
But more detailed info tables you can find in sys.tables and sys.objects,  sys.indexes.

You can join them together as much as you want. OBJECT_ID() and OBJECT_NAME() can be helpfull to change from one type to the other.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now