Removing data based on a field that is to be removed
NigelFindlater
Posts: 1 New member
in ReadyRoll
I have a table with a field IsActive. I want to make a migration that removes the field and updates the table based on this field. For example
SELECT [Id],[IsActive],[data]FROM [TestDb].[dbo].[MyTable]
Id IsActive data
1 0 1f
2 1 2t
3 1 3t
4 0 4f
I want to first delete from [TestDb].[dbo].[MyTable] where IsActive=false
Then I want to drop the IsActive column.
And in one transaction
How do I do this?
SELECT [Id],[IsActive],[data]FROM [TestDb].[dbo].[MyTable]
Id IsActive data
1 0 1f
2 1 2t
3 1 3t
4 0 4f
I want to first delete from [TestDb].[dbo].[MyTable] where IsActive=false
Then I want to drop the IsActive column.
And in one transaction
How do I do this?
Tagged:
Best Answer
-
PlantBasedSQL Posts: 187 Gold 4Hi, @NigelFindlater thank you for your question! ReadyRoll provides a method to edit all of the migration scripts you create to take account of data moves such as this - a similar process is discussed here: https://www.simple-talk.com/sql/database-delivery/fix-ten-ssdt-deployment-snags-without-readyroll when splitting a column.