

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[vCalcolaCopieEffettiveSomma]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[vCalcolaCopieEffettiveSomma]
GO
/****** Object:  View [dbo].[vCalcolaCopieEffettiveSomma]    Script Date: 30/10/2018 16:32:38 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[vCalcolaCopieEffettiveSomma]
AS
SELECT        SUM(ISNULL(CopieRese, 0)) AS CopieRese, IDDocumentoRiga
FROM            dbo.vCalcolaCopieEffettive
GROUP BY IDDocumentoRiga

GO