Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Save a value
Message
De
25/11/2006 03:09:17
 
 
À
24/11/2006 16:06:13
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:
01172386
Vues:
12
>but where I can add 1 to the result

Did you test the code?
See that I changed the code to be:
'select @TestMe = MAX(NOTEINDX)+1 from ['+@server+'].['+@base+'].[dbo].[SY03900] '
BUT if you want to add 1:
CREATE PROCEDURE dbo.abc2
@server varchar(20),
@base varchar(20),
AS
DECLARE @pnCampo3 numeric(19,5)
DECLARE @Nextvalue int
DECLARE @cad varchar(1000)
set @pnCampo3 = 0.0
set @cad='select @TestMe = MAX(NOTEINDX) from ['+@server+'].['+@base+'].[dbo].[SY03900] '

SET @Nextvalue = 0
sp_executeSql @cad,'@TestMe int OUTPUT', @TestMe = @Nextvalue OUTPUT
SET @Nextvalue = @Nextvalue + 1
SELECT @Nextvalue
set @pnCampo3=@pnCampo3+1.0
I also don't understand why you put yourself into trouble, why not just made this field to be identity?
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
Répondre
Fil
Voir

Click here to load this message in the networking platform