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

  • Home
  • SEARCH
  • 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 112297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:31:21+00:00 2026-05-11T02:31:21+00:00

Is the following stored procedure code robust for multi-user application. It is working fine.

  • 0

Is the following stored procedure code robust for multi-user application. It is working fine. I was wondering if there is any better way to do it and if there is any performance issues.

The proc has three sql statements together like 1.Updating hardware status in Allocation Table 2. Calculating Next appropriate Primary Key value for new record to be inserted in DEFECT_LOG table 3.Inserting the values into DEFECT_LOG table. I am also using a variable to return 1 if the transaction was successful.

ALTER PROCEDURE spCreateDefective  (      @alloc_ID nvarchar(50),     @cur_date datetime,     @problem_desc nvarchar(MAX),     @got_defect_date datetime,     @trans_status tinyint OUTPUT --Used to check transaction status )  AS  /*  Transaction Maintainer Statements   */  BEGIN TRAN transac1      SET XACT_ABORT ON      SET TRANSACTION ISOLATION LEVEL SERIALIZABLE  /*  Declaration Area    */      DECLARE @temp nvarchar(10)      DECLARE @def_ID nvarchar(20)  /*  Updating Inventory Status to 'Defective' and Updating Release Date to current System date   */        UPDATE INV_Allocation_DB      SET INV_STATUS = 'Defective' , RELEASE_DATE=@cur_date     WHERE INV_ID=@alloc_ID   /*  Calculates New Primary Key for the DEFECT_LOG Table */  --  Returns the largest number or 1 if no records are present in the table        SELECT @temp=COALESCE(CONVERT(int,SUBSTRING(MAX(DEFECT_ID),5,5))+1,1) FROM DEFECT_LOG       SET @def_ID = 'DEF_'+ RIGHT(replicate('0',5)+ convert(varchar(5),@temp),5)  /*  Insert statement for inserting data into DEFECT_LOG */      INSERT INTO DEFECT_LOG (DEFECT_ID,INV_ID,PROB_DESC,GOT_DEFECT_DATE)      VALUES(@def_ID,@alloc_ID,@problem_desc,@got_defect_date)       SET @trans_status = 1      COMMIT TRAN transac1  /*  Returns 1 if transaction successful */  RETURN @trans_status 
  • 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. 2026-05-11T02:31:22+00:00Added an answer on May 11, 2026 at 2:31 am

    Using a SERIALIZABLE transaction level is not recommended unless you absolutely have to have one. It will increase the likelihood of blocking and decrease throughput.

    You seem to be using it in order to guarantee a unique DEFECT_ID? Why not use an IDENTITY column for DEFECT_ID instead?

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

Sidebar

Ask A Question

Stats

  • Questions 84k
  • Answers 84k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer On unix systems, multiprocessing uses os.fork() to create the children,… May 11, 2026 at 5:04 pm
  • Editorial Team
    Editorial Team added an answer EF does not do automatic lazy loading. You need to… May 11, 2026 at 5:04 pm
  • Editorial Team
    Editorial Team added an answer Would the dynamic linq library help here? In particular, I'm… May 11, 2026 at 5:04 pm

Related Questions

I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) ,
i'm not sure this is the best way to do the following code. I'm
Well I have this MySQL stored procedure that I wrote and if I run
Current, I've got a stored procedure that has a main goal of doing a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.