alter proc [dbo].[sp_bhV]
@tno char(18),
@bar varchar(13)
as
begin
if exists(select 1 from sysobjects where name='v_bh' and type='v')
drop view v_bh
declare @str varchar(2000)
set @str='create view v_bh '
+' as '
+' select a.dbarcode as dbarcode,a.dname as dname,a.unit_name as unit,b.dnum_bh as bh,c.dnum as store '
+' from f_thing as a,f_thing_bh as b, f_store as c '
+' where b.dbarcode='''
+@bar
+''' and b.t_no ='''
+@tno
+''' and b.dbarcode=a.dbarcode and b.dbarcode=c.dbarcode'exec (@str)
end
@tno char(18),
@bar varchar(13)
as
begin
if exists(select 1 from sysobjects where name='v_bh' and type='v')
drop view v_bh
declare @str varchar(2000)
set @str='create view v_bh '
+' as '
+' select a.dbarcode as dbarcode,a.dname as dname,a.unit_name as unit,b.dnum_bh as bh,c.dnum as store '
+' from f_thing as a,f_thing_bh as b, f_store as c '
+' where b.dbarcode='''
+@bar
+''' and b.t_no ='''
+@tno
+''' and b.dbarcode=a.dbarcode and b.dbarcode=c.dbarcode'exec (@str)
end
@tno char18,
@bar varc13
as
begin
if exists(select 1 from sysobjects where name='v_bh' and type='v')
drop view v_bh
declare @str varchar(2000)
set @str='create view v_bh '
+' as '
+' select a.dbarcode as dbarcode,a.dname as dname,a.unit_name as unit,b.dnum_bh as bh,c.dnum as store '
+' from f_thing as a,f_thing_bh as b, f_store as c '
+' where b.dbarcode='''
+@bar
+''' and b.t_no ='''
+@tno
+''' and b.dbarcode=a.dbarcode and b.dbarcode=c.dbarcode' exec(@str)
end
@tno char18,
@bar varc13
as
begin
if exists(select 1 from sysobjects where name='v_bh' and type='v')
drop view v_bh
declare @str varchar(2000)
set @str='create view v_bh '
+' as '
+' select a.dbarcode as dbarcode,a.dname as dname,a.unit_name as unit,b.dnum_bh as bh,c.dnum as store '
+' from f_thing as a,f_thing_bh as b, f_store as c '
+' where b.dbarcode='
+@bar
+' and b.t_no ='
+@tno
+' and b.dbarcode=a.dbarcode and b.dbarcode=c.dbarcode' exec(@str)
end