Jump to content


Photo

Mudar O Owner De Um Objeto Mssql


  • Faça o login para participar
Nenhuma resposta neste tópico

#1 MACUL

MACUL

    Doutor

  • Usuários
  • 770 posts
  • Sexo:Masculino
  • Localidade:SP

Posted 25/05/2006, 11:27

/* ########################## Macul.eti.br ########################## */
/* Criada xx/xx/200x Versão : 0.0 AUTOR : Marcelo Colla Desc: # */
/* ########################## Macul.eti.br ########################## */

DECLARE @AlterString NVARCHAR(500) 
Declare @VtableName varchar(50)
DECLARE @Cursor CURSOR 
Set @Cursor = CURSOR FOR Select Rtrim(Name) as TName From SysObjects Where Xtype = 'U' 
Open @Cursor 
Fetch NExt From @Cursor Into @VtableName 
While @@Fetch_Status = 0 
Begin 
Exec('EXEC sp_changeobjectowner ''' + @VtableName + ''', ''mcolla''') 
Fetch NExt From @Cursor Into @VtableName 
End

Por Marcelo Colla
*************** M ** A ** C ** U ** L ***************

*************************************************




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq