ALTER TABLE [FIES].[T_MO_PARAMETER_VALUE] ADD [FloatValue] decimal(20, 6) NULL
GO
update pv
set pv.FloatValue = pv.Value
from [FIES].[T_MO_PARAMETER_VALUE] pv
GO

ALTER TABLE [FIES].[T_MO_PARAMETER_VALUE] DROP COLUMN [Value]
GO



ALTER TABLE [FIES].[T_MO_PARAMETER_VALUE] ADD [StringValue] varchar(255) NULL
GO



ALTER TABLE [FIES].[T_MO_PARAMETER_VALUE] ADD [DateValue] datetime NULL
GO



ALTER TABLE [FIES].[T_MO_PARAMETER_VALUE] ADD [type_] int NULL
GO
update pv
set pv.type_ = (select e.EntityID from VCLib.T_ENTITIES e where e.EntName = 'MO_PARAMETER_VALUE_FLOAT')
from [FIES].[T_MO_PARAMETER_VALUE] pv
GO
ALTER TABLE [FIES].[T_MO_PARAMETER_VALUE] ALTER COLUMN [type_] int NOT NULL
GO

ALTER TABLE [FIES].[T_MO_PARAMETER_VALUE] WITH NOCHECK ADD CONSTRAINT [FK_T_ENTITIES_T_MO_PARAMETER_VALUE_type_]
FOREIGN KEY([type_]) REFERENCES [VCLib].[T_ENTITIES] ([EntityID])
GO
