/ Published in: SQL
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
CHANGE owner ON SQL server db. Restore DATABASE FROM .bak file CREATE login give dbo ROLE. Run the script: USE db GO SELECT ‘EXEC(â€sp_changeobjectowner @objname = â€â€â€™+ ltrim(u.name) + ‘.’ + ltrim(s.name) + â€â€â€ + ‘, @newowner = NEWOWNERâ€)’ FROM sysobjects s, sysusers u WHERE s.uid = u.uid AND u.name ‘NEWOWNER’ AND xtype IN (‘V’, ‘P’, ‘U’, ‘FN’) AND u.name NOT LIKE ‘INFORMATION%’ ORDER BY s.name copy paste RESULT TO query analyzer GO DELETE OLD USER EXEC sp_changedbowner ‘newowner’ CHANGE login name FOR dbo TO newowner (pwd = same) bmssa/bmssa