IF EXISTS (SELECT 1 FROM SYS.VIEWS WHERE NAME = 'LD0VAA0SearchFormSeachDefinitions')
BEGIN
DROP VIEW LD0VAA0SearchFormSeachDefinitions 
END
GO
CREATE VIEW LD0VAA0SearchFormSeachDefinitions AS
SELECT DISTINCT v24.SOKDEFNR, v24.SOKDEFNAMN, v04.TYPDOK, v04.DYNDELSYS
FROM Ld0v0v24 V24
INNER JOIN LD0V0v25 V25 ON V25.SOKDEFNR = V24.SOKDEFNR
INNER JOIN LD0V0v05 v05 ON V25.FRAGENR = V05.FRAGENR
INNER JOIN LD0V0v04 v04 ON v04.FORMNR = v05.FORMNR
WHERE v04.TYPDOK > 0
GO
GRANT ALL ON LD0VAA0SearchFormSeachDefinitions TO LD0ROANV
GO
