--Migration DECLARE @sql nvarchar(max) = N'' SELECT @sql = 'ALTER TABLE [dbo].[T_FOGLALKOZAS] DROP CONSTRAINT [' + d.name + '];' FROM sys.default_constraints d INNER JOIN sys.all_columns c ON c.column_id = d.parent_column_id AND d.parent_object_id = c.object_id WHERE d.parent_object_id = OBJECT_ID('T_FOGLALKOZAS') AND c.name = 'C_TULORASZAM' EXEC sp_executesql @sql GO ALTER TABLE [dbo].[T_FOGLALKOZAS] ALTER COLUMN [C_TULORASZAM] NUMERIC (10, 2) NOT NULL; GO ALTER TABLE [dbo].[T_FOGLALKOZAS] ADD DEFAULT ((0)) FOR [C_TULORASZAM]; GO DECLARE @sql nvarchar(max) = N'' SELECT @sql += 'EXEC sp_refreshview ''[' + SCHEMA_NAME(schema_id) + '].[' + name + ']'';' FROM sys.views v WHERE v.name IN ('T_FOGLALKOZAS', 'T_FOGLALKOZAS_OSSZES') EXEC sp_executesql @sql GO