IF EXISTS (SELECT 1 FROM SYS.TABLES WHERE NAME='LD0P0SERVICECONTACT')
BEGIN
DROP TABLE LD0P0SERVICECONTACT
END
;
IF EXISTS (SELECT 1 FROM SYS.VIEWS WHERE NAME='LD0V0SERVICECONTACT')
BEGIN
DROP VIEW LD0V0SERVICECONTACT
END
;

CREATE TABLE LD0P0SERVICECONTACT
(
    SERVICEID decimal(9, 0) NOT NULL,
    CONTACTID decimal(9, 0) NOT NULL,
    INVESTIGATIONID decimal(9, 0) NOT NULL,
    INVCONTACTID decimal(9, 0) NOT NULL,
    NAME varchar(180) NOT NULL,
    TYPE varchar(180) NOT NULL,
    PHONE varchar(32) NOT NULL,
    EMAIL varchar(100) NOT NULL,
    ADDRESS varchar(70) NOT NULL,
    ZIPCODE varchar(5) NOT NULL,
    CITY varchar(64) NOT NULL,
    UPDDAT varchar(8) NOT NULL,
    UPDSIGN varchar(10) NOT NULL
)
GO

CREATE UNIQUE CLUSTERED INDEX LD0C0SERVICECONTACT ON LD0P0SERVICECONTACT
(
    SERVICEID,
    CONTACTID
)
GO

CREATE VIEW LD0V0SERVICECONTACT AS 	SELECT * FROM LD0P0SERVICECONTACT
GO
GRANT ALL ON LD0V0SERVICECONTACT TO LD0ROANV
GO