Twitter Updates

    follow me on Twitter

    Wednesday, October 12, 2005

    SQL Server - alle objecten owned by dbo maken

    Dit statement genereerd voor elk object dat niet 'owned by dbo' is een sp_changeobjectowner statement.

    SELECT 'EXEC(''sp_changeobjectowner @objname = '''''+ 
    ltrim( + '.' + ltrim( + ''''''
    + ', @newowner = dbo'')'
    FROM sysobjects s,
    sysusers u
    WHERE s.uid = u.uid
    AND <> 'dbo'
    AND xtype in ('V', 'P', 'U')
    AND not like 'INFORMATION%'
    order by

    No comments: