we have just a little discussion in the ofc with @@identity vs @@ident_current... it's like this, i have a stored procedure define as..
CREATE PROCEDURE [uspInsertData]
@FldName varchar(1000),
@FldValue varchar(1000),
@tablename varchar(100)
AS
declare @sql varchar(8000)
set @sql = @sql + @FldName + " values('" + @fldValue + "')"
exec (@sql)
select @@Identity
go
...
According to my ofcmates, i should use @@ident_current instead of @@identity because it will create error in a multi-user environment.
my stand is since it is in a stored procedure, i would always have a guarantee that i will get return the correct identity... am i correct or should i concede to them and use @@ident_current instead of @@identity?
CREATE PROCEDURE [uspInsertData]
@FldName varchar(1000),
@FldValue varchar(1000),
@tablename varchar(100)
AS
declare @sql varchar(8000)
set @sql = @sql + @FldName + " values('" + @fldValue + "')"
exec (@sql)
select @@Identity
go
...
According to my ofcmates, i should use @@ident_current instead of @@identity because it will create error in a multi-user environment.
my stand is since it is in a stored procedure, i would always have a guarantee that i will get return the correct identity... am i correct or should i concede to them and use @@ident_current instead of @@identity?