Search code examples
c#t-sqlsmo

How to create ALTER scripts instead of CREATE scripts using SMO (Server Management Object)


I am using the Microsoft.SqlServer.Management.Smo classes to script out SQL scripts for stored procedures, tables, views etc. I am doing this for putting them in source control.

Instead of the CREATE scripts for stored procedures, how can I get ALTER scripts for them? Is there an setting / option in the ScriptingOptions' properties?


Solution

  • There seems to be no setting for ALTER scripts. The property with ScriptingOptions.ScriptDrops as true creates the drop statements. The downside to this is that the permissions would have to reassigned.

    Closing this question.