• 1-888-289-2246
  • 24x7x365 Presence

How to change database schema to DBO


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

]]>


Leave a Reply

Your email address will not be published. Required fields are marked *