What are the challenges you face when working across database platforms? Take the survey
Options

Removing data based on a field that is to be removed

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?

Best Answer

Sign In or Register to comment.