I've found the relevant flag:
/p:ScriptDatabaseOptions=False
sqlpackage publish action creates alter for the whole DB
Hi
I'm running the below sqlpackage
action command (my change is only one predeploy
script with one alter):
sqlpackage /action:Script /SourceFile:"Database Services\bin\Debug\Database Services.dacpac" /TargetConnectionString:"Data Source=TESTL05,123;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;Initial catalog=test" /OutputPath:"C:\git\SnapshotDiff.sql
and when I'm looking in the sql
I see this code:
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET ANSI_NULL_DEFAULT ON
WITH ROLLBACK IMMEDIATE;
END
why this part was generated? can I avoid it using of one of these flags:
https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-script?view=sql-server-ver15#properties-specific-to-the-script-action
-
arielman2304 676 Reputation points
2021-06-15T12:05:09.077+00:00