I need the last inserted row GUID at the time of page loading in ASP.NET. I tried with a stored procedure, but at the time of insertion I am getting how to use that value in the page load procedure like this:
USE [emp]
GO
/****** Object: StoredProcedure [dbo].[procTestTableInsert] Script Date: 3/12/2014 5:55:33 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[procTestTableInsert]
(
@name varchar(50)
)
AS
DECLARE @id uniqueidentifier
SELECT @id = NEWID()-- Get a new unique identifier to insert
INSERT
testTable1(id,name)
VALUES
(@id,@name)
SELECT @id
exec procTestTableInsert sree