STORED PROCEDURE ERRO
Ola Rodrigo,
Criei a tabela com os mesmos campos que vc escreveu, esta dando um erro na linha 11 do select:
execute no seu sql verá o erro:
Create Proc sp_GenID
@tabela varchar(50),
@ID int output
as
SELECT @ID = nrseq from GenID (updlock)
where nmTabela = @tabela
UPDATE GENID SET NSEQ = @ID + 1 where nmtabela
select @id as nrseq <== Nesta linha da erro
RETURN
[]s.
Jair
Jair Cruz
Curtidas 0
Respostas
Rodrigo Mourão
09/12/2008
Ok Jair Estou verificando !!!!
GOSTEI 0
Rodrigo Mourão
09/12/2008
Segue Comandos corretos:
CREATE PROCEDURE GEN_ID
@tabela varchar(50),
@id int out
AS SELECT @ID = nrseq from GenID (updlock)
where nmTabela = @tabela
UPDATE GENID SET NrSEQ = @ID + 1 where nmtabela = @tabela
RETURN @id GO
@tabela varchar(50),
@id int out
AS SELECT @ID = nrseq from GenID (updlock)
where nmTabela = @tabela
UPDATE GENID SET NrSEQ = @ID + 1 where nmtabela = @tabela
RETURN @id GO
GOSTEI 0
Rodrigo Mourão
09/12/2008
Olá Jair,
Há mais alguma dúvida?? Podemos encerrar o chamado ???
Estamos no aguardo !!
GOSTEI 0
Jair Cruz
09/12/2008
Ola Rodrigo,
Como faço pra fazer um teste no query analyzer do sql server 2000?
[]s
Jair
GOSTEI 0
Rodrigo Mourão
09/12/2008
Olá Jair, rapaz eu fiz o teste pelo delphi mesmo dando showmessage no valor retornado !! Agora no query analiza, não fiz !!!
Vou verificar aqui, se eu me lembro bem tem que criar um parametro para receber o retorno e dar um print. Eu vejo e post a resposta aqui !!
abs
GOSTEI 0
Rodrigo Mourão
09/12/2008
Olá Jair,
O código abaixo executa a proedure no query analize !!!
/*Decalração de Variaveis*/
declare @id int
declare @tabela varchar(50)
set @tabela = Cliente /*execução*/ exec Gen_ID @tabela, @id output PRINT Id Gerado = + cast(@id as varchar)
abs !! Estamos no aguardo para encerrarmos o chamado.
declare @tabela varchar(50)
set @tabela = Cliente /*execução*/ exec Gen_ID @tabela, @id output PRINT Id Gerado = + cast(@id as varchar)
abs !! Estamos no aguardo para encerrarmos o chamado.
GOSTEI 0
Jair Cruz
09/12/2008
Ok Rodrigo,
Caso encerrado.
[]s.
Jair
GOSTEI 0