[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

Details on SQL Server dbo and INFORMATION_SCHEMA

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
crazywolf2010
Asked:
crazywolf2010
1 Solution
 
jogosCommented:
<<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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now