Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why no return value?
Message
De
08/04/2002 10:39:10
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Why no return value?
Divers
Thread ID:
00642190
Message ID:
00642190
Vues:
42
Hello Group

I am new at sql server.
I am trying to update a table and return the nextuniq number so that I can update my primary key table with the next avaialble primary key.

My question is why isn't this returning anything?
In my test with thequery analyzer i type in
execute sp_create_translator_table 451001830, 0

my stored procedure is:

CREATE PROCEDURE sp_create_translator
@Nextuniq int, @ReturnNextUniq int output
AS
/****** Object: Table [dbo].[translator] Script Date: 4/1/2002 9:13:23 AM ******/
if exists (select * from sysobjects where id = object_id(N'[dbo].[translator]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[translator]

DECLARE @Home_suniq int , @Ident varchar(10)
DECLARE translator_cursor CURSOR
DYNAMIC
FOR

SELECT
jw2.suniq AS home_suniq,
jw2.ident
FROM
dbo.jw2_studemo_suniq_ident as jw2
WHERE
NOT EXISTS (select * from dbo.catcboe_students where ident = jw2.ident)



OPEN translator_cursor

FETCH NEXT FROM translator_cursor INTO @Home_suniq, @Ident


While @@FETCH_STATUS = 0
BEGIN


INSERT INTO translator
( suniq, ident,oldsuniq )

VALUES
(@nextuniq, @Ident, @Home_suniq)

set @Nextuniq = @Nextuniq + 1

FETCH NEXT FROM translator_cursor INTO @Home_suniq, @Ident

END
SET @ReturnNextUniq = @Nextuniq

CLOSE translator_cursor
DEALLOCATE translator_cursor


I would like it to return the current value of @nextuniq to the calling program.

Thanks
Jim
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform