Get Last Affected Rows Number

Hello Guys,

If you want to get last affected rows, while inserting records into yor table using below procedure, will help you..


CREATE PROCEDURE usp_AddCustomer
@custName varchar(150),
@custEmail varchar(150),
@custMob varchar(50)

AS
BEGIN
SET NOCOUNT ON
INSERT INTO CustomerDetails
(
custName,
custEmail,
custMob

)
VALUES
(
@custName,
@custEmail,
@custMob
)

SELECT @@IDENTITY AS AffectedRowsNo
END


Store your AffectedRowsNo value to get updated rows.number

Comments