Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Incrementing folio problem
Message
From
30/05/2013 11:47:07
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01575144
Message ID:
01575147
Views:
66
>>Hi,
>>
>>We have a folio (unique number) which needs to be incremented by one every time a user needs it.
>>The problem is that SQL Servers seems to hung and never returns the incremented number. This happens when we have concurrency of several users.
>>
>>The code is the following:
>>
>>
>>
>>USE [Cal_hon_Desa]
>>GO
>>/****** Object:  StoredProcedure [dbo].[Sel_Trae_Folio_ICS]    Script Date: 05/30/2013 09:34:10 ******/
>>SET ANSI_NULLS ON
>>GO
>>SET QUOTED_IDENTIFIER ON
>>GO
>>
>>
>>-- =============================================
>>-- Author:        xxxxx
>>-- Create date: 11-01-2012
>>-- Description:   Selecciona los datos de operacion a calcular
>>-- =============================================
>>ALTER PROCEDURE [dbo].[Sel_Trae_Folio_ICS]
>>
>>AS
>>BEGIN
>>      Select Folio_TB_ics from PRM_Folios
>>            UPDATE dbo.PRM_Folios
>>      SET Folio_TB_ICS = Folio_TB_ics + 1
>>END
>>
>>
>>
>>Any ideas on how to make this code better or what we are doing wrong?
>>
>>Thanks,
>>Daniel
>
>Why you're not using identity column?

In another recent thread, a person got angry because he disliked experts not answering the original question. Show him how to use what he is trying to use and don't tell him what not to do.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform