if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[vClientiBadge]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[vClientiBadge]
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.vClientiBadge
AS
SELECT     dbo.Badge.codbadge, dbo.Soggetti.IDSoggetto, dbo.Soggetti.RagioneSociale, dbo.Soggetti.Citta, dbo.Soggetti.Indirizzo, dbo.Soggetti.Cap, 
                      dbo.Soggetti.Prov, dbo.Badge.dataemissione, dbo.Badge.saldo, dbo.Soggetti.IDTipoSoggetto
FROM         dbo.Soggetti INNER JOIN
                      dbo.Badge ON dbo.Soggetti.IDSoggetto = dbo.Badge.idcliente

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

