IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_user]') AND type = 'V')
DROP VIEW [dbo].[mps_user]
GO

CREATE view [dbo].[mps_user] as
 
  select cu_cmpid,cu_id,cu_gender,lgu_bcid as cu_bcid,dp_dpstdid as cu_dpstdid , 
  lgu_dpid as cu_dpid,lgu_otid as cu_otid,lgu_function as cu_function ,
  lgu_otlevel as cu_otlevel , lgu_managelevel as cu_managelevel , lgu_professionlevel as cu_professionlevel 
  from mps_login , mps_login_role , mps_depart 
  where lgu_cuid=cu_id   and lgu_dpid=dp_id