{"id":308,"date":"2007-09-12T15:04:29","date_gmt":"2007-09-12T14:04:29","guid":{"rendered":"http:\/\/www.galhano.com\/blog\/?p=308"},"modified":"2008-02-07T18:36:12","modified_gmt":"2008-02-07T17:36:12","slug":"mudar-o-ownership-de-um-objecto","status":"publish","type":"post","link":"http:\/\/galhano.com\/blog\/?p=308","title":{"rendered":"Mudar o ownership de um objecto"},"content":{"rendered":"<p>sp_changeobjectowner<\/p>\n<p><em>Fonte: <\/em><a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/Aa259618(SQL.80).aspx\"><em>http:\/\/msdn2.microsoft.com\/en-us\/library\/Aa259618(SQL.80).aspx<\/em><\/a><\/p>\n<p><!--more--><\/p>\n<p><strong>New Information &#8211; SQL Server 2000 SP3.<\/strong><\/p>\n<p>Changes the owner of an object in the current database.<\/p>\n<h5>Syntax<\/h5>\n<p><strong>sp_changeobjectowner<\/strong> [ <strong>@objname<\/strong> <strong>= <\/strong>] <strong>&#8216;<\/strong><em>object<\/em><strong>&#8216; ,<\/strong> [ <strong>@newowner<\/strong> <strong>= <\/strong>] <strong>&#8216;<\/strong><em>owner<\/em><strong>&#8216;<\/strong><\/p>\n<h5>Arguments<\/h5>\n<p>[<strong>@objname<\/strong> <strong>=<\/strong>] <strong>&#8216;<\/strong><em>object<\/em><strong>&#8216;<\/strong><\/p>\n<p class=\"indent\">Is the name of an existing table, view, user-defined function, or stored procedure in the current database.<strong> <\/strong><em>object<\/em> is <strong>nvarchar(517)<\/strong>, with no default.<strong> <\/strong><em>object<\/em> can be qualified with the existing-object owner, in the form <em>existing_owner<\/em>.<em>object<\/em>.<\/p>\n<p>[<strong>@newowner<\/strong> <strong>=<\/strong>] <strong>&#8216;<\/strong><em>owner<\/em><strong>&#8216;<\/strong><\/p>\n<p>Examples<\/p>\n<p>This example changes the owner of the <strong>authors<\/strong> table to <strong>Corporate\\GeorgeW<\/strong>.<\/p>\n<pre><code>EXEC sp_changeobjectowner &#039;authors&#039;, &#039;CorporateGeorgeW&#039; <\/code><\/pre>\n<p class=\"indent\">Is the name of the security account that will be the new owner of the object. <em>owner<\/em> is <strong>sysname<\/strong>, with no default. <em>owner<\/em> must be a valid Microsoft\u00c2\u00ae SQL<strong> <\/strong>Server\u00e2\u201e\u00a2 user or role, or Microsoft Windows NT\u00c2\u00ae user or group in the current database. When specifying Windows NT users or groups, specify the name the Windows NT user or group is known by in the database (added using <strong>sp_grantdbaccess<\/strong>).<\/p>\n<h5>Return Code Values<\/h5>\n<p>0 (success) or 1 (failure)<\/p>\n<p>EXEC sp_changeobjectowner &#8216;authors&#8217;, &#8216;Corporate\\GeorgeW&#8217;<!--1023f4bb4c59a420209b25dfea5b25fc--><!--f048968f389130f33a5b8668a7e350a9--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>sp_changeobjectowner Fonte: http:\/\/msdn2.microsoft.com\/en-us\/library\/Aa259618(SQL.80).aspx<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"close","ping_status":"close","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,1],"tags":[],"class_list":["post-308","post","type-post","status-publish","format-standard","hentry","category-sql-server","category-uncategorized","author-admin"],"_links":{"self":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=308"}],"version-history":[{"count":0,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/308\/revisions"}],"wp:attachment":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=308"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}