Aby zmienić scheme tabel na dbo w danej bazie danych MSSQL Server nalezy wykonac poniższe zapytanie:
DECLARE
tabcurs
CURSOR
FOR
SELECT
'AKTUALNESCHEME.'
+ [
name
]
FROM
sysobjects
WHERE
xtype =
'u'
OPEN
tabcurs
DECLARE
@tname NVARCHAR(517)
FETCH
NEXT
FROM
tabcurs
INTO
@tname
WHILE @@fetch_status = 0
BEGIN
EXEC
sp_changeobjectowner @tname,
'dbo'
FETCH
NEXT
FROM
tabcurs
INTO
@tname
END
CLOSE
tabcurs
DEALLOCATE
tabcurs