When I run the following code on SQL Server (docker) it makes the db as contained first time around, but in a SQL managed instance it creates it as a "none" contained db, the subsequent ALTER
is required to fix that.
if db_id('test11') is not null
begin
print 'dropping old db';
exec('drop database test11;');
end;
GO
print 'making db';
CREATE DATABASE test11 CONTAINMENT = PARTIAL;
GO
IF not EXISTS(SELECT * FROM sys.databases WHERE [name] = 'test11' and containment_desc = 'PARTIAL')
begin
print 'fixing containment as it didn''t work forst time';
ALTER DATABASE test11 SET CONTAINMENT = PARTIAL;
end;
GO
SQL server (docker) output
dropping old db
making db
SQL Managed Instance output
dropping old db
making db
fixing containment as it didn't work forst time