0

I am just starting out with SQL Server and I let Entity Framework code first create my data tables. Here's the SQL for one of the tables:

CREATE TABLE [dbo].[UserProfile] (
    [UserId]   INT            IDENTITY (1, 1) NOT NULL,
    [UserName] NVARCHAR (MAX) NULL,
    PRIMARY KEY CLUSTERED ([UserId] ASC)
);

I notice "dbo" but I am not sure what this means. Is this similar to the data being stored in the master database? Now I would like to manually drop / create tables instead of letting EF do this.

Can someone tell me if there is a better way for me to create the tables. Should I for instance create them with something other than dbo? Also can I create multiple databases within my SQL Server and then place my tables there?

abatishchev
  • 98,240
  • 88
  • 296
  • 433

1 Answers1

0

dbo stands for 'database owner'. It is simply the default schema in SQL Server. EF Code first uses the dbo schema by default. If you want to overide, see:

How can I stop Entity Framework 5 migrations adding dbo. into key names?

[Schemas are used to group objects. For instance, a Report schema might contain read-only views used for reporting.]

Community
  • 1
  • 1
Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
  • Thanks - So would a system normally store it's user login information under dbo or would it create a different owner? –  Feb 27 '13 at 04:37
  • Logins, though related, are different things. You grant access rights to the dbo schema to a user or role, which is then associated with a login – Mitch Wheat Feb 27 '13 at 04:44
  • http://stackoverflow.com/questions/7973134/understanding-sql-server-2008-security-logins-roles-etc – Mitch Wheat Feb 27 '13 at 04:46