Auflösen eines Texts in verschiedenen Spalten

select

[Transactions],

Date,

substring([Dimensionsspalten], 1,P1.Pos-1) AS BestellNr,

substring([Dimensionsspalten], P1.Pos + 1, P2.Pos – P1.Pos – 1) AS Campaign,

substring([Dimensionsspalten], P2.Pos + 1, P3.Pos – P2.Pos – 1) AS Channelgrouping,

substring([Dimensionsspalten], P3.Pos + 1, P4.Pos – P3.Pos – 1) AS Source,

substring([Dimensionsspalten], P4.Pos + 1, P5.Pos – P4.Pos – 1) AS Zeitstempel,

substring([Dimensionsspalten],P5.Pos+1,LEN([Dimensionsspalten]) ) AS Medium

 

from [ga_EcommerceExport]

cross apply (select (charindex(‘,’, [Dimensionsspalten]))) as P1(Pos)

cross apply (select (charindex(‘,’, [Dimensionsspalten], P1.Pos+1))) as P2(Pos)

cross apply (select (charindex(‘,’, [Dimensionsspalten], P2.Pos+1))) as P3(Pos)

cross apply (select (charindex(‘,’, [Dimensionsspalten], P3.Pos+1))) as P4(Pos)

cross apply (select (charindex(‘,’, [Dimensionsspalten], P4.Pos+1))) as P5(Pos)

cross apply (select (charindex(‘,’, [Dimensionsspalten], P5.Pos+1))) as P6(Pos)

0 Kommentare

Hinterlasse einen Kommentar

An der Diskussion beteiligen?
Hinterlasse uns deinen Kommentar!

Schreibe einen Kommentar