IDENT_CURRENT returns newly inserted record‘s auto
increment value. So you can use this data while inserting a record it can be
useful in many times. For example you want to return newly inserted record is
for other task etc.
USE [girfa]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--
=============================================
--
Author: Raj Kumar
--
Create date: 08-Aug-2017
--
Description: Girfa Student Help
--
=============================================
alter PROCEDURE [dbo].[adddata]
(@name nvarchar(20),@city nvarchar(20))
AS
BEGIN
declare @id varchar(20)
insert into stu (roll,name,city)
values('Girfa'+ CONVERT(varchar(10),IDENT_CURRENT('[dbo].[stu]')),@name,@city)
end
No comments:
Post a Comment