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

CREATE VIEW LD0VAA0SearchProfessionals AS 
SELECT
I.*,
I02.BESADR AS BESADR_T,
I02.ORT AS BESORT_T,
Q01.KLARTEXT AS DELEGATION_T,
I04.ANVID,
I02_2.BESADR AS BESADR2_T,
I02_2.ORT AS BESORT2_T
FROM LD0V0I I 
LEFT OUTER JOIN LD0V0Q01 Q01 ON Q01.KODTYP = 'DELEGATION' AND Q01.KOD = I.DELEGATION 
LEFT OUTER JOIN LD0V0I02 I02 ON I02.ADRKOD = I.ADRKOD 
LEFT OUTER JOIN LD0V0I04 I04 ON I04.HAND = I.HAND 
LEFT OUTER JOIN LD0V0I02 I02_2 ON I02_2.ADRKOD = I.ADRKODSDN
GO

GRANT SELECT ON LD0VAA0SearchProfessionals TO LD0ROANV
GO
