Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
declare @attribute VARCHAR(200) = 'Komponente1'

deleteDELETE fromFROM tStueckliste where
WHERE kStueckliste IN
 (SELECT
select 			a.kStueckliste from
		FROM tartikel a
join		JOIN dbo.tArtikelAttribut a1 on
			ON a1.kArtikel = a.kArtikel
join		JOIN dbo.tArtikelAttributSprache aas on
			ON aas.kArtikelAttribut = a1.kArtikelAttribut
join		JOIN dbo.tAttributSprache as1 on
			ON as1.kAttribut = a1.kAttribut
			AND and as1.kSprache = 0

where		WHERE as1.cName = @attribute and
		AND ISNULL(aas.cWertVarchar, '') != ''
		AND and a.kStueckliste != 0
)

updateUPDATE a
setSET a.kStueckliste = 0
fromFROM tartikel a
joinJOIN dbo.tArtikelAttribut a1
	ON on a1.kArtikel = a.kArtikel
joinJOIN dbo.tArtikelAttributSprache aas on
	ON aas.kArtikelAttribut = a1.kArtikelAttribut
joinJOIN dbo.tAttributSprache as1
	ON on as1.kAttribut = a1.kAttribut and
	AND as1.kSprache = 0

whereWHERE as1.cName = @attribute
AND and ISNULL(aas.cWertVarchar, '') != '' and
AND a.kStueckliste != 0