How to get an Id of last inserted record in backend and display in flex
How to get an Id of last inserted record from backend and开发者_StackOverflow display the same with success message as "RECORD INSERTED SUCCESSFULLY AS" +Id in flex... am using Toad for sql server.......
If you are using SQL Server 2005 or 2008, use the function SCOPE_IDENTITY()
, otherwise use the variable @@IDENTITY
. For example, if you have a table with an auto-increment column id and a column value:
DECLARE @newid int
INSERT INTO mytable (value) VALUES 'x'
SET @newid = SCOPE_IDENTITY()
SELECT @newid
精彩评论