1
Change DB Owner For SQL 2000 database objects
Problem reported by Greg C. - June 21, 2015 at 7:30 AM
Submitted
Employee Post
Step1:
declare @OldOwner varchar(100)
    declare @NewOwner varchar(100)
    set @OldOwner = 'Test1'
    set @NewOwner = 'dbo'
    select 'sp_changeobjectowner ''[' + table_schema + '].[' + table_name + ']'', ''' + @NewOwner + '''
    go'  
    from information_schema.tables where Table_schema = @OldOwner
 
Step 2: Get ALL stored procedured in MS SQL 2000
select specific_name from information_schema.routines
where routine_type='PROCEDURE' and SPECIFIC_Schema='Test1'
select specific_name from information_schema.routines
where routine_type='FUNCTION' and SPECIFIC_Schema='Test1'
 
sp_changeobjectowner '[tenders].[ClienteUsuarioSectorSubSector]', 'dbo'   
go
 

Reply to Thread