
PRINT 'EXECUTE 022'
GO

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

CREATE VIEW dbo.v_mclBook_RefOccurrenceSourceRel
AS
SELECT     dbo.Reference.IdInMCL, dbo.emOccurrenceSource.OccurrenceFk, dbo.emOccurrenceSource.SourceNumber, dbo.Reference.RefId
FROM         dbo.emOccurrenceSource INNER JOIN
                      dbo.mclBook_RefSourceNumberRel ON dbo.emOccurrenceSource.SourceNumber = dbo.mclBook_RefSourceNumberRel.SourceNumber INNER JOIN
                      dbo.Reference ON dbo.mclBook_RefSourceNumberRel.RefFk = dbo.Reference.RefId

 
GO


