IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_g_1prd]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_g_1prd]
GO
create procedure [dbo].[mps_g_1prd](
@cmpid int,
@pctag int,
@prdid bigint
)
as
begin
set nocount on 
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED 
declare @tbname varchar(50)
declare @dbname varchar(50)
declare @fkey   varchar(50) 
exec sys_sql_getTableNamePk @cmpid,'prd',@pctag,0,@tbname output,@fkey output ,@dbname output 
declare @sql nvarchar(4000) 
set @sql = 'select * from '+@dbname+@tbname+' where prd_id='+LTRIM(rtrim(str(@prdid)))  
execute(@sql) 
set nocount off
end