Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8454073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:55:44+00:00 2026-06-10T11:55:44+00:00

I created a stored procedure in SQL Server 2012 and I have used scope_identity

  • 0

I created a stored procedure in SQL Server 2012 and I have used scope_identity to get identity column’s value but in my case I do not know is this correct or not please help

CREATE PROCEDURE Add_Translation
    @english nvarchar(70),
    @kurdish nvarchar(70),
    @english_category int,
    @kurdish_category int,
    @result int out
AS
BEGIN
    SET NOCOUNT ON;

    if @english is not null and @kurdish is not null and @english_category is not null and @kurdish_category is not null
    begin
        insert into english_table values(@english, @english_category);

        declare @identityEnglish int;
        set @identityEnglish = SCOPE_IDENTITY();

        insert into kurdish_table values(@kurdish, @kurdish_category);
        declare @identityKurdish int;
        set @identityKurdish = SCOPE_IDENTITY();

        insert into transactions values(@identityEnglish, @identityKurdish);
        set @result = 1;
    end
    else
    begin
        set @result = 0;
    end
END

My question is that will the variable @identityEnglish get last identity value of english_table and variable @identityKurdish get last identity value of kurdish_table

thank you..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:55:45+00:00Added an answer on June 10, 2026 at 11:55 am

    If the inserts succeed then scope_identity() works correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an stored procedure in SQL Server 2008 and it contains the
I have created a little complex stored procedure on SQL Server 2008 R2 and
I have created a stored procedure in SQL Server 2005, also I create another
In SQL Server Management Studio 2008, I created a Stored Procedure, but its not
I have created a stored procedure in SQL Server, which runs immediately from Management
I have created a SQL Server stored procedure which I have bound to my
I have the following SQL Server stored procedure : BEGIN TRAN CREATE TABLE #TempTable
I have a dynamic SQL statement I've created in a stored procedure. I need
I've created following stored procedure in my SQL server 2005 database for general pagination:
Using SQL Server 2008 I created a Stored Procedure called MyStoreProc and it runs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.