sql server - How to know the value of the INT sequential I just INSERTed in SQL 2008 R2 -
i have these tables (simplified clarity):
table changes changeid bigint memberid varchar(10) changedon smalldatetime table fieldchanges changeid bigint fieldname varchar(30) oldvalue varchar(100) newvalue varchar(100)
in order keep track of changes made member (memberid
).
what want insert
record in changes
, sql generating sequential value (by using isidentity
) changeid
column , insert
record in fieldchanges
value , other details. now, insert
, select
latest record memberid
, wondering if there efficient way this, sql returning value of changeid
column when doing insert
.
to identity value of inserted identity column, use select scope_identity()
the scope specific stored proc, script batch, function or trigger.
Comments
Post a Comment