Archive for

SQL Server: Change the Owner of All Tables to “dbo”

This is a simple piece of T-SQL code that allows you to change the ownership of all tables in a given database. In the example the ownership is being changed to “dbo” but that could be replaced with any owner andor schema you wanted. It does use an undocumented stored procedure sp_MSforeachtable wich enumerates all … Continue reading