IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[AKUZ].[V_DRUG_FORM]'))
DROP VIEW [AKUZ].[V_DRUG_FORM]
GO

--IF  EXISTS (SELECT * FROM sys.tables WHERE object_id = OBJECT_ID(N'[AKUZ].[V_DRUG_FORM]'))
--DROP table [AKUZ].[V_DRUG_FORM]
--GO

--SET ANSI_NULLS ON
--GO

--SET QUOTED_IDENTIFIER ON
--GO

----View для T_DRUG_FORM уникальные mnn 
--CREATE VIEW [AKUZ].[V_DRUG_FORM]
--AS
--select null [Mnn] ,null [Trn] ,null [MedicationForms] ,null [DoseView] ,null [Dose] ,null [DoseCount] ,null [Doses] ,null [VolumeView] ,null [Weigth] ,null [WeightView] ,null [Volume] ,null [Code] ,null DateAddFederal, null DateRemoveFederal, null DateAddSN,null DateRemoveSN,null DateAddRegional,null DateRemoveRegional, null BenefitCode,631 type_, null [IsMI], null LSFO, ISNULL(null,0) RRL
----	from dbo.T_DRUG_FORM
----union
----select [Mnn] ,null ,[MedicationForms] ,[DoseView] ,[Dose] ,[DoseCount] ,[Doses] ,[VolumeView] ,[Weigth] ,[WeightView] ,[Volume], ~(min([Code])) ,DateAddFederal, DateRemoveFederal, DateAddSN,DateRemoveSN,DateAddRegional,DateRemoveRegional, BenefitCode,630, [IsMI], LSFO, ISNULL(RRL,0)
----	from dbo.T_DRUG_FORM
----	group by Mnn, MedicationForms ,DoseView ,Dose ,DoseCount ,Doses ,[VolumeView] ,[Weigth] ,[WeightView] ,[Volume], DateAddFederal, DateRemoveFederal, DateAddSN,DateRemoveSN, DateAddRegional,DateRemoveRegional,BenefitCode,[IsMI],LSFO, ISNULL(RRL,0)
--GO