Data Loss Check in Script
medi_pv
Posts: 8
I'm using the SDK to generate schema and data compare scripts.
The current system we use is from visual studio. When something occurs that will cause data loss (like dropping a column), the script will contain something like the following:
From what I can tell RedGate does not provide an option to do something like this. Am I correct?
RedGate will instead generate a 'high' warning it would appear. Just want to make sure I am not missing an option or something...
The current system we use is from visual studio. When something occurs that will cause data loss (like dropping a column), the script will contain something like the following:
IF EXISTS (select top 1 1 from [MyTable].[MyColumn])
RAISERROR (N'Rows were detected. The schema update is terminating because data loss might occur.', 16, 127) WITH NOWAIT
From what I can tell RedGate does not provide an option to do something like this. Am I correct?
RedGate will instead generate a 'high' warning it would appear. Just want to make sure I am not missing an option or something...
Comments
You are correct, SQL Compare will generate a warning but will not introduce a guard clause.
SQL Source Control another of our tools, enables user to create migration scripts to deal with data loss situations.
Thank you,
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools