Показать сообщение отдельно
Старый 12.03.2007, 17:30   #1  
Blog bot is offline
Blog bot
Участник
 
25,477 / 846 (79) +++++++
Регистрация: 28.10.2006
axaptapedia: Change table owner
Источник: http://www.axaptapedia.com/Change_table_owner
==============

Summary: change sql owner
This is more a MSSQL-tips, but it can be usefull for Axapta when you attach a existing database to your MSSQL-server. Sometimes the user of the attached database has the same name as the one already declared in MSSQL-server. Then use this code to generate another code who change the ownershop of each table in the attached database:


SELECT 'exec sp_changeobjectowner ''' + ltrim(u.name) + '.' + ltrim(s.name) + ''',' + '''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


--[[User:Codewire.net|CODEWIRE.NET]] 06:36, 12 March 2007 (EDT)


Источник: http://www.axaptapedia.com/Change_table_owner