devxlogo

Determine the Identity Value of Inserted Row(s)

IN tblTicker table we have following fields:

 	[CompanyID] INT IDENTITY (1,1)	[TickerSymbol] [char] (10) NULL	[ClassOfShare] [char] (10) NULL

We inserted some rows and deleted some from table tblTicker.Now At the time of fresh insertion if we will use the following code we will get the identity value of inserted row.

 INSERT INTO tblTicker(TickerSymbol,ClassOfShare)VALUES('SRCE','A')SELECT @@IDENTITY

If the table tblTicker was having 5 rows and then we deleted any two rows. Now if we insert one row the Identity value will be 6.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Engineering Leaders Spot Weak Proposals

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.