IF NOT EXISTS(SELECT 1 FROM sys.columns 
          WHERE Name = N'KONTTITEL'
          AND Object_ID = Object_ID(N'LD0P0U70'))
BEGIN
ALTER TABLE LD0P0U70
	ADD KONTTITEL VARCHAR(162)
   CONSTRAINT LD0P0U70_KONTTITEL DEFAULT ' ' NOT NULL
END
;

IF EXISTS (SELECT 1 FROM SYS.VIEWS WHERE NAME = 'LD0V0U70')
BEGIN
DROP VIEW LD0V0U70
END
;

CREATE VIEW LD0V0U70 AS SELECT * FROM LD0P0U70
;

IF EXISTS (SELECT 1 FROM SYS.VIEWS WHERE NAME = 'LD0VAA0LMSIMPLEPLACE')
BEGIN
DROP VIEW LD0VAA0LMSIMPLEPLACE
END
;

CREATE VIEW LD0VAA0LMSIMPLEPLACE
AS
SELECT U70.*, 
Q.KLARTEXT HUVUDMAN_T, 
Q2.KLARTEXT BRANSCH_T
FROM LD0V0U70 U70 
LEFT JOIN LD0V0Q01 Q 
ON Q.KODTYP = 'LNHUVUDMAN' 
AND Q.KOD = U70.HUVUDMAN
LEFT JOIN LD0V0Q01 Q2 
ON Q2.KODTYP = 'LNBRANSCH' 
AND Q2.KOD = U70.BRANSCH
;

