drop proc sh_datos_tabla_maestra
go

create proc sh_datos_tabla_maestra

@TABLE ud_descripcion,
@PERSITE BIT,
@SITEID UD_IDSITE
as

declare @cadena VARCHAR(1000)

IF(@PERSITE=0)
	set @cadena='select * from '+@table +' where (stknew=1 or stkmodify=1) '
ELSE
	set @cadena='select * from '+@table +' where SITEID ='+ @SITEID +' AND (stknew=1 or stkmodify=1) '

--SELECT @cadena
exec (@cadena)

go

sh_datos_tabla_maestra 'IN_INVENTORYDAT',1,'57'

select * from custwarranty