Thursday, July 4, 2013

SQL 2012 - sp_dboption is no more....

Ultra confident a set of trusted scripts would work on SQL 2012, I came across this today, sp_dboption has gone from SQL 2012.

The solution is to use the relevent ALTER DATABASE syntax.

Old : EXEC sp_dboption 'Adventureworks', 'single user', 'TRUE';
New : ALTER DATABASE Adventureworks SET SINGLE_USER

Old : EXEC sp_dboption 'Adventureworks', 'single user', 'FALSE';
New : ALTER DATABASE Adventureworks SET MULTI_USER

This post from Jacob Sebastian details the rest ...
Replacement for system stored procedure sp_dboption in SQL Server 2012 (Denali)


No comments: