Last active
May 10, 2017 12:15
-
-
Save camous/e8eb5edac13a08b65fb4cf52a3078d15 to your computer and use it in GitHub Desktop.
alter existing stored procedure produced by TableDependency for supporting "replay"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using (var con = new SqlConnection(Properties.Settings.Default.ConnectionString)) | |
{ | |
con.Open(); | |
var serverConnection = new ServerConnection(con); | |
var server = new Server(serverConnection); | |
foreach (Trigger trigger in server.Databases["DATABASE"].Tables["Employee", "HumanResources"].Triggers) | |
{ | |
Trace.TraceInformation("alter trigger " + trigger.Name + " created on " + trigger.CreateDate); | |
var noexceptbody = Regex.Replace(trigger.TextBody, @"EXCEPT (.*) \[m_Old\]", String.Empty); | |
trigger.TextBody = noexceptbody; | |
trigger.TextMode = false; | |
trigger.Alter(); | |
} | |
con.Close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment