Solved Sql Store last value of a control field

Posted on 2014-07-11
Last Modified: 2014-07-15
I am using an application in multiposition environment (sqlserver/ and wanted to know what the last record inserted in a particular table and store the value of a control field, outside or in another bd bd. The intention is to know if someone deleted or changed the control id of the last record.
The reason I wanted to keep the last control field record  in an out bd is because someone can make a database restore.
Question by:rflorencio
    LVL 21

    Expert Comment

    by:Randy Poole
    Not quite sure what your looking for, to pull back and identity value on an insert?

    Author Comment


    I have a table with a field called IdCtrl with an alphanumeric code assigned by application. Before insert a new record i need to know if this code is really the same of last record inserted.
    In practice i need to ensure that the last record of the table is even the last. So if someone delete the last record I can know.
    LVL 83

    Accepted Solution

    Is it your application only that inserts the records? If yes then you can store the IdCtrl in another database when you insert a record. That way, you have the last inserted id of the record in another database.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now