USE [DD_ECM]
GO

/****** Object:  View [dbo].[VWCUST_STAMP]    Script Date: 21.03.2024 17:06:11 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE VIEW [dbo].[VWCUST_STAMP] AS
--SELECT 'FF' FG_TYP,4711 as DocID, 'm.schreiber@honey.de' as Email, 'Ja' as Freigabe, convert(Datetime,'2019-12-17 12:40:25',120) Wann
--UNION
--SELECT 'VA' FG_TYP,4711 as DocID, 'n.schreiber@honey.de' as Email, 'Ja' as Freigabe, convert(Datetime,'2019-12-17 12:32:40',120) Wann
--UNION
--SELECT 'VA' FG_TYP,4711 as DocID, 'v.schreiber@honey.de' as Email, 'Ja' as Freigabe, convert(Datetime,'2019-12-17 12:28:19',120) Wann
--UNION
--SELECT 'FF' FG_TYP,4712 as DocID, 'm.Kamm@dd-works.de' as Email, 'Ja' as Freigabe, convert(Datetime,'2019-12-17 12:40:25',120) Wann
--UNION
--SELECT 'VA' FG_TYP,4712 as DocID, 'v.feygin@ukraina.de' as Email, 'Ja' as Freigabe, convert(Datetime,'2019-12-16 12:11:08',120) Wann
--UNION
--SELECT 'VA' FG_TYP,4712 as DocID, 'j.hoss@karate.de' as Email, 'Ja' as Freigabe, convert(Datetime,'2019-12-14 11:28:23',120) Wann
--UNION
--SELECT 'VA' FG_TYP,4712 as DocID, 'a.treubenbach@stitching.de' as Email, 'Ja' as Freigabe, convert(Datetime,'2019-12-13 18:28:23',120) Wann
--GO
SELECT
	Vec.dwDocID as DocID,
	(SELECT Data FROM FNDD_SPLIT_STRING(Vec.szvalue,'~') where SequentialOrder = 1) as Email,
	(SELECT Data FROM FNDD_SPLIT_STRING(Vec.szvalue,'~') where SequentialOrder = 2) as [Freigabe],
	(SELECT Data FROM FNDD_SPLIT_STRING(Vec.szvalue,'~') where SequentialOrder = 5) as [FG_TYP],
	(SELECT Data FROM FNDD_SPLIT_STRING(Vec.szvalue,'~') where SequentialOrder = 4) as [Wann]
FROM 
	windream60.dbo.Vector Vec 
WHERE 
	--vec.dwDocID = 741833 AND
	vec.dwAttrID = 10040 AND
	SUBSTRING((SELECT Data FROM FNDD_SPLIT_STRING(Vec.szvalue,'~') where SequentialOrder = 5),7,6) IN ('ER 4.0','ER 2.0')

--	select * from windream60.dbo.Vector where dwDocID = 785040 and dwAttrID = 10040



GO


