---创建视图
CREATE VIEW view_wf_huizhi
as SELECT * FROM openquery(ORAWMS16,'select * from view_wf_huizhi')
SELECT * FROM view_wf_huizhi where 出库日期 between '2021.01.01' and '2021.12.31'
SELECT cast(WMS合并单号 as varchar(20)),* FROM view_wf_huizhi where 出库日期 >= '2021.01.01'
---针对超过15位数字导出EXCEL变科学计数法,创建临时表。
select (''''+WMS合并单号) as 单号,* into ##view_wf_huizhi
from view_wf_huizhi where 出库日期 >= '2021.01.01'
SELECT * FROM ##view_wf_huizhi
DROP TABLE ##view_wf_huizhi
--创建无参数存储过程,过程用来生成临时表
create procedure Getview_wf_huizhi
as
begin
select (''''+WMS合并单号) as 单号,* into ##view_wf_huizhi from view_wf_huizhi where 出库日期 >= '2021.01.01'
end
--执行无参数存储过程
execute Getview_wf_huizhi
execute Droview_wf_huizhi
create procedure Droview_wf_huizhi
as
begin
DROP TABLE ##view_wf_huizhi
end