>after that to use the result to get a value form on select statment.
>
>SELECT @MPQ = SELECT MPQ FROM @RESULT + 'PARM'
DECLARE @RESULT VARCHAR(100);
SET @RESULT=''
DECLARE @mpq int;
SET @mpq=0
DECLARE @TableName VARCHAR(40);
SET @TableName = 'parm'
SELECT @RESULT = OBJECT_SCHEMA_NAME ( OBJECT_ID(@TableName ))
DECLARE @sql nvarchar(4000)
SET @sql = 'SELECT @Test = Mpq FROM '+@RESULT + '.'+@TableName
sp_executesql @sql, N'@Test int OUTPUT', @Test =@mpq
SELECT @MPQ
not tested
I see you have no WHERE in your clause, that means you could have unpredictable results if you have more than one record in that table.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.