I am using Microsoft.SqlServer.Management.Smo classes for script from SQL scripts for stored procedures, tables, views, etc. I do this in order to put them in the original management.
Instead of CREATE scripts for stored procedures, how can I get ALTER scripts for them? Is there a / option parameter in ScriptingOptions properties ?
There seems to be no settings for ALTER scripts. A property with ScriptingOptions.ScriptDrops as true creates drop statements. The disadvantage of this is that permissions had to be reassigned.
The completion of this question.
Take a look at DBSourceTools .
This is a GUI tool for scripting all objects in an SQL database to disk, in particular for managing databases from source code. Back-end uses SMO.
.
foreach (string line in script) { string l = line.Replace("CREATE FUNCTION", "ALTER FUNCTION"); }
.:).
. toSP - SP. "TO" , Create(), Alter() StoredProcedure spT
If toSP = "" Then ' Empty spT.Create() Else spT.Alter() End If
StoredProcedure , ALTER.
StoredProcedure
ALTER
https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.storedprocedure.scriptheader(v=sql.120).aspx
Using
var sprocHeader = sproc.ScriptHeader(forAlter: true); var sprocBody = sproc.TextBody;
Source: https://habr.com/ru/post/1752680/More articles:ASP.NET MVC Images / CSS not displaying for web application with website - iis-7The fastest way to copy SQL data - sqlвыравнивание контейнеров 3? - htmlNHibernate new SchemaExport (cfg) .Execute (false, true, false, false); There is no fourth parameter bool - nhibernateToken based server access token error with infrastructure error - sql-servercan this be shortened to be less code? - jqueryApache CXF and Spring MVC - javaCan the ECB be limited to “capture” only the current buffer when it is activated? - rCustom Swing Appearance and Custom Components? - javaJavascript unitary framework - javascriptAll Articles