IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[privateview_27]') AND type = 'V')
DROP VIEW [dbo].[privateview_27]
GO
CREATE VIEW [dbo].[privateview_27]
AS
select cu_id objid,cu_account,cu_callname,cu_title zhij,ord_zzzb,cu_depart ,'管理人员' dp_type,cu_dpid,cu_title
from mps_login,order_40 
where ord_gh = cu_account 
and ord_zzzk != '离职'
and cu_dpid =  2575
union 
select cu_id objid,cu_account,cu_callname,ord_zhij zhij,ord_zzzb,cu_depart ,'普通员工' dp_type,cu_dpid,cu_title
from mps_login,order_40 ,mps_depart
where cu_dpid = dp_id 
and  dp_isdepart = 1 
and ord_gh = cu_account 
and ord_zzzk != '离职'