Create a table so that the user is the owner

I understand that the default behavior when creating a table in SQL 2005 is that it will be created with dbo as the owner of the table. Is there a way to change this default behavior so that all tables are created as user and not as dbo? I'm working on moving an application from SQL 2000 to SQL 2005 and most of the logic in the application makes the assumption that the default behavior is to create a table with the user as owner.

+1


source to share


1 answer


First you can create a schema (which you or a user-user) and then create the table (s) under the schema, ala:

CREATE TABLE [yourSchema].[sales](...)

      



The schema / owner situation in sql2005 is different from others.

The good thing is that the schema name is not the same as the owner name. And if the owner of the current schema ever leaves you, you can reassign the ownership of the schema to someone else.

+1


source







All Articles