Convert owner field as loginAdmin
I have created a database in MS SQL Server 2000 and set the log in for the database before creating any table in it. In Query Analyzer, I log in by giving a username and password, and use the create table syntax for creating the table. The table is created successfully.
Table Name: Table1
Login Name: LoginAdmin
In Enterprise Manager, it is showing the owner field for the table as the LoginAdmin. These are all right. But when I created another table through Enterprise Manager directly under the same database, it is taking the owner field as DBO in all tables that are created using Enterprise Manager. If I want to convert the owner field as the loginAdmin what should I do?
In Query Analyzer, select the database you wish to work with and then use the stored procedure "sp_changeobjectowner." You'll have to supply that stored procedure with the name of the table and the name of the new owner.
Do you have comments on this Ask the Expert Q&A? Let us know.
This was first published in April 2005