General information
Fórum:
Microsoft SQL Server
Environment versions
SQL Server:
SQL Server 2005
Hi
I want to use Scope_Identity to return the newly created record ID in my table. My code, thus far, looks something like:
ALTER procedure [dbo].[Candidate_Insert_Blank]
@CreatedByID int, @CandidateID int output
as
begin
set nocount on;
insert into Candidate (CreatedByID)
values (@CreatedByID)
set @CandidateID = cast(scope_identity() as int)
end
CandidateID is a field within Candidate and it's automatically incremented using Indentify Increment. In reality, I want the stored procedure to return the value of field Candidate.CandidateID.
Regards
Next
Responder
Visualizar o mapa desta thread
View the map of this thread starting from this message only
Visualizar todas as mensagens desta thread
Visualizar todas as mensagens desta thread a partir desta mensagem