Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

The usage of Ident_current

$
0
0

Hi,

I have a question on this Ident_Current. I am getting duplicates when the code below is run (example):

DECLARE @s_RatingSessionNo nvarchar(30);

SET @d_CurrentSystemTime = CS.F_GetSystemDateTime();
SET @s_RSN = AS.F_FormatRSN(IDENT_CURRENT('AS.T_PSN') + 1);  

-- Change the current sesionID to become like '10002' if current sessionID is 10001, so that when insert below, my record will be like

(SessionID, RSN) = (10002, A10002)

INSERT INTO AS.T_PSN
( RSNNo) Values (@s_RSN)

I'd searched as well until i found this link:

http://www.dbsimplified.com/2011/06/difference-between-identcurrent.html

It stated that : If Two Users Are Inserting Rows into Same Table and At Any Point Both The Users are Trying to find out Identity of table then both will get the same. i..e. Last Inserted Identity.

Hope you can help me to clarify on this as I can't seem to find any further answer from Microsoft.

Thank you.


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>