Vytux

  • Increase font size
  • Default font size
  • Decrease font size
Home FAQ Usefull Code Change owner of all tables in database to 'dbo'

Create PDF Email Print

Change owner of all tables in database to 'dbo'

Author:
Vytautas
Date added:
Wednesday, 25 February 2009

Answer

The following oneliner can be used to change ALL of the table owners to dbo or any other user you choose. It uses an undocumented Microsoft SQL stored procedure and as such may not work on all version of MS SQL Server or other databases based on T-SQL.

1
2
--Change owner to dbo for ALL tables in DB
sp_MSforeachtable @command1="sp_changeobjectowner '?', 'dbo'"

 


Category

Tags for this item

Discount Hotel Reservation - HotelClub

Sponsored Links


Lithuanian Name Days


Yesterday (2010-09-11) : Girmantė, Konstancija, Mikalojus, Tautgirdas
Today (2010-09-12) : Augantas, Gytautė, Gytė, Hetga
Tomorrow (2010-09-13) : Gvidas, Marija, Tolvaldas, Vaidmantė
Made by: Vytux!