Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find a schema on function
Message
 
À
02/06/2008 08:57:44
Issam Mansour
Jordan Business Machines
Amman, Jordanie
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01320930
Message ID:
01320942
Vues:
14
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform