IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[privateview_1]') AND type = 'V')
DROP VIEW [dbo].[privateview_1]
GO
CREATE VIEW [dbo].[privateview_1]
AS
/*采购合同*/
select 100000000+ord_id objid , 
ord_htbh as [合同编号], 
ord_type as [合同类型],
ord_htmc as [合同名称], 
ord_dsje as [合同金额],
ord_gys as [合同乙方],
ord_status as [状态],
ord_bizid
from order_170
where ord_status='签订成功'
union 
/*加盟合同*/
select 200000000+ord_id objid, 
ord_htbh as [合同编号], 
ord_type as [合同类型],
ord_htmc as [合同名称], 
ord_htje as [合同金额],
ord_compname as [合同乙方],
ord_status as [状态],
ord_bizid 
from order_171
where ord_status='签订成功' or ord_status='已使用' 
union 
/*房屋租赁合同*/
select 300000000+ord_id objid ,
ord_htbh as [合同编号] , 
ord_type as [合同类型], 
ord_htmc as [合同名称], 
ord_zfje as [合同金额],
ord_czf as [合同乙方],
ord_status as [状态],
ord_bizid 
from order_172
where ord_status='签订成功'
union 
/*其他合同*/
select 400000000+ord_id objid ,
ord_htbh as [合同编号] ,
ord_type as [合同类型],  
ord_htmc as [合同名称],
ord_htje as [合同金额],
ord_htyf as [合同乙方],
ord_status as [状态],
ord_bizid 
from order_173
where ord_status='签订成功'