devxlogo

Determine the Identity Value of Inserted Row(s)

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.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

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.

About Our Journalist