Capture warnings
bhopenw
Posts: 39
From the cmd line can you capture or get warnings that a table and/or column will be dropped before a sync is committed?
If not is there any way to get this before a sync job?
I have automation setup to auto sync databases, and I have new requirement to not sync a DB if a table and/or column will be drop. Basically, they don't want to auto sync a database if data loss is going to occur w/o a backup.
Any and all help would be great
BJHop
If not is there any way to get this before a sync job?
I have automation setup to auto sync databases, and I have new requirement to not sync a DB if a table and/or column will be drop. Basically, they don't want to auto sync a database if data loss is going to occur w/o a backup.
Any and all help would be great
BJHop
Comments
I was able to capture a table drop by examining the results of a sync script creation (Up script) command. I am running in Powershell therefore I was able to look of a line that begin with 'TABLE' and contains '<<'
Now I just need a way to find column drops which I think will be a bit more of a challenge.
Again any and all ideas are welcome
thanks,
BJHop
I had done something similar for DOS quite awhile back by running SQL Compare, examining the output, and using it to build a command that excludes all tables containing the double-arrows to prevent any table drops. Here is the forum post containing the batch file:
http://www.red-gate.com/MessageBoard/vi ... sqlcompare
I that is the way I'm going to move now, unless, anyone has a way w/o the SDK.
Thanks,
BJHop
Using the SDK, the best idea I've had would be to analyze all tables that have a status of "different" and create a migration script just for that table using Regions, and loop through the Regions looking for the DROP COLUMN command and find a way to rip that SQL out of the migration.
I've had another look at this issue, and Regions are not the right way to go -- they are only useful when scripting an individual object from one database. I have put together a working example of how you can eliminate column drops from the migration script. This may be of interest to you:
http://labs.red-gate.com/index.php/Filt ... ion_script
Good stuff, I like what you have done. This does look to be the way to go, thanks. Nevertheless, I think I am going to be push back on the BA to see if I can change the requirement to force backup for Table drops only for this release. This way I don't have to add the complexity of the SDK to my scripts for to a release due next week.
Again thank you
BJHop