Why do scripts not put owner create statements for sprocs?
mdp2176
Posts: 10
I've read all the posts on comparing objects with different owners, and that is fine. But how come the resulting SQL from SQLCompare does not put the object owner in the create statement for stored procedures? It does it for tables, but not stored procedures.
This discussion has been closed.
Comments
The ownership given to a stored procedure depends on the creation SQL. If the script for the stored procedure (by double-clicking in in Enterprise Manager, etc) looks like:
CREATE PROCEDURE MyProc...
...then the Stored Procedure will inherit the ownership of the user who ran the migration script produced by SQL Compare, regardless of the ownership reported by SQL Server through Enterprise Manager or Query Analyzer. If the script for the stored procedure looks like this:
CREATE PROCEDURE dbo.MyProc...
...then the ownership would be dbo, assuming you're logged in under a dbo role, of course.
This is the way that the software works currently. We'll look into better ways of handling ownership in the future.