Tech Tip: Quickly enable or disable replication for all tables
PRODUCT: 4D | VERSION: 15.x | PLATFORM: Mac & Win
Published On: March 6, 2017
Here is a method that can be used to disable or enable replication on every table in the database:
C_BOOLEAN($1) C_LONGINT($a) C_TEXT($toggle;$tableName;$sql) If (Count parameters=1) $toggle:=Choose($1;"ENABLE";"DISABLE") For ($a;1;Get last table number) // loop over all tables If (Is table number valid($a)) // table number is valid (not deleted) $tableName:=Table name($a) $sql:="ALTER TABLE ["+$tableName+"] "+$toggle+" REPLICATE;" Begin SQL EXECUTE IMMEDIATE :$sql; End SQL End if End for End if |
If this method is saved as a project method named toggle_Replication then it could be used like this:
toggle_Replication (True) // enable replication on all tables toggle_Replication (False) // disable replication on all tables |