use master; go sp_dbcmptlevel SomeDB, 90; go -- more scriptIt failed miserably and of course rendered a bunch of procedures invalid (as those included cross and outer apply). The deployment account running the script was a member of the db\_owner role, and it just so happens that in order to change the compat level of the user database from the context of master, the db\_owner membership is not enough! One must be sa or the database owner. In other words, if I had the script written like this:
use SomeDB; go sp_dbcmptlevel SomeDB, 90; gothen it would work, because db\_owner membership would be enough, but to achieve the same result from the context of master is not enough. The good news is that this proc should not be used in better versions of SQL Server, the **alter database set compatibility_level = xx** should be used instead. Anyway, it taught me a lesson :)
No one has followed this question yet.
Looping through a dataset of records.
Implications of dynamically created table with large number of users
How to write errorlog to the SQL errorlog file from stored proc
Price for service based on duration and priceinterval
Updating of base table through keyset driven cursors is going into infinite loop