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

CREATE VIEW LD0VAA0SEARCHCONCERNREPORTERRAND AS SELECT 
*,
CASE 
	WHEN FIRSTNAME<>' ' AND LASTNAME=' ' THEN FIRSTNAME
	WHEN FIRSTNAME=' ' AND LASTNAME<>' ' THEN LASTNAME
	WHEN FIRSTNAME<>' ' AND LASTNAME<>' ' THEN LASTNAME+', '+FIRSTNAME
	ELSE ' '
END
AS FULLNAME,
FORMAT(REPORTDATE, N'yyyyMMdd') as REPORTDATEDATE
FROM LD0P0CONCERNREPORTERRAND
;