Support
EN PT ES
Wiki
Content
Discussion
History
Backlinks

How to change user owner of a table in SQL Server

To change the owner user (owner) of a set of tables in SQL Server need to run the following SQL statement: 
 
select 'exec sp_changeobjectowner'' dbo.' + Name +'' ','' gxportal''' + nchar (10) + ';' 
from sysobjects 
where xtype = 'U' 
 
This generates as many sentences as tables (with dbo owner) has the database. Statements that are generated as follows and must to select them, copy them, paste them into a SQL statement and then execute them. 
 
sp_changeobjectowner exec 'dbo. <TABLE>', 'gxportal' 
 
In this example dbo is the current user and user gxportal to be assigned as owner. 
 
 

Categories:

    Wiki home
    Categories
    Recents changes
    TOUR
    Tutorials
    Documentation
    COMPANY
    Support
    © All rights reserved. GeneXus TM is registered to GeneXus S.A. | Privacy Policy | Contact information