SQL Server Tables Named With dbo Schema

后端 未结 1 717
北荒
北荒 2021-01-04 07:37

I\'ve been finding SQL Server schemas to be very confusing. Maybe you guys can help me clear up some confusion. I\'m using SQL Server 2008 Express and MS SQL Server 2008 Man

1条回答
  •  温柔的废话
    2021-01-04 08:15

    You might want to start by reading this: What good are SQL Server schemas?

    From SQL Server 2005 onwards, schemas were separated from users http://msdn.microsoft.com/en-us/library/ms190387.aspx.

    Prior to that, each user owns several tables, which will be in their "space". That "space" is now a schema, which is a way to group tables.

    SQL Server Objects have 4 parts to their names

    • server.database.schema.objectname

    Whenever you omit one or more of them, you are naming it from the right

    • database.schema.objectname - implied current server
    • schema.objectname - implied current database
    • objectname - implied default schema. each user can be assigned a default schema, but by default this will be "dbo"

    "dbo" is a special schema, it is the database-owner. It exists in every database, but you can add schemas (like folders) to databases

    If you migrate from older installations of SQL Server 2000 dbs to 2005 or beyond, you may bring along the schemas-named-as-users, because the users "own"ed the tables.

    0 讨论(0)
提交回复
热议问题