Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Save a value
Message
 
 
À
24/11/2006 14:34:05
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01172323
Message ID:
01172326
Vues:
19
See How to return a value from dynamicaly executed T-SQL code FAQ #8130

>
>I have the next store procedure:
>
>CREATE PROCEDURE dbo.abc2
>@server varchar(20),
>@base varchar(20),
> AS
>DECLARE @pnCampo3 numeric(19,5)
>DECLARE @cad varchar(1000)
>set @pnCampo3 = 0.0
>set @cad='select MAX(NOTEINDX) from ['+@server+'].['+@base+'].[dbo].[SY03900] '
>exec(@cad)
>set @pnCampo3=@pnCampo3+1.0
>GO
>
>but I need get the value of [exec(@cad)] in a variable in order to add (1) to the result, for example if [exec(@cad)] = 5 I need get 5+1=6.
>
>I put somthing like this but is a error:
>set @pnCampo3=exec(@cad)
>
>How can I do this?
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform