| Author |
Changing owner of DB objects
|
|
|
| I have a database where all objects within it and owned by a user not dbo.
Is there any way I can change all the object ownerships to dbo? I'm talking
thousands of objects so I'm thinking some form of script.
thanks
Gav
| |
| Uri Dimant 2006-11-16, 5:20 am |
| Gav
SELECT 'EXEC sp_changeobjectowner
'''+ROUTINE_NAME+'''
,''dbo'''
FROM INFORMATION_SCHEMA.ROUTINES
WHERE OBJECTPROPERTY(OBJEC
T_ID(ROUTINE_SCHEMA+
'.'+ROUTINE_NAME),
'IsMsShipped')=0
AND ROUTINE_SCHEMA != 'dbo'
"Gav" <gav@nospam.com> wrote in message
news:455c2cce$0$696$
88260bb3@news.teranews.com...
>I have a database where all objects within it and owned by a user not dbo.
>Is there any way I can change all the object ownerships to dbo? I'm talking
>thousands of objects so I'm thinking some form of script.
>
> thanks
>
> Gav
>
| |
| Tibor Karaszi 2006-11-16, 5:21 am |
| What version of SQL Server?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/
"Gav" <gav@nospam.com> wrote in message news:455c2cce$0$696$
88260bb3@news.teranews.com...
>I have a database where all objects within it and owned by a user not dbo. Is there any way I can
>change all the object ownerships to dbo? I'm talking thousands of objects so I'm thinking some form
>of script.
>
> thanks
>
> Gav
>
| |
|
| Sorry, forgot the obvious. :o) 2000 SP3a.
"Tibor Karaszi" <tibor_please.no. email_karaszi@hotmai
l.nomail.com> wrote in
message news:eVnJq0WCHHA.3604@TK2MSFTNGP03.phx.gbl...
> What version of SQL Server?
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www. solidqualitylearning
.com/
>
>
> "Gav" <gav@nospam.com> wrote in message
> news:455c2cce$0$696$
88260bb3@news.teranews.com...
>
>
| |
| Tibor Karaszi 2006-11-16, 5:21 am |
| See Uri's post (sp_changeobjectowne
r).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/
"Gav" <gav@nospam.com> wrote in message news:455c42c8$0$709$
88260bb3@news.teranews.com...
> Sorry, forgot the obvious. :o) 2000 SP3a.
>
> "Tibor Karaszi" <tibor_please.no. email_karaszi@hotmai
l.nomail.com> wrote in message
> news:eVnJq0WCHHA.3604@TK2MSFTNGP03.phx.gbl...
>
>
|
|
|
|