Query for reteriving the last updated record.

  • Dear Friend,

    Can you tell me the query for reteriving the last updated record. Is there a way to do it.

    Thank you.

  • Sadiq,

    You need to use a trigger with this format:-

    CREATE TRIGGER [Name] ON [Table]

    AFTER UPDATE

    AS

    UPDATE [Table / Column]

    INSERT INTO [Table] SELECT [* / Column] FROM Deleted d

    Have fun

    Steve

    We need men who can dream of things that never were.

  • Another option is to have a ModifiedDtTm column with the Date/Time of when the records have been modified and then all you would have to do is SELECT [columns here] FROM [YourTable] WHERE ModifiedDtTm =

    (SELECT MAX(ModifiedDtTm) FROM [YourTable]

    Or some variant thereof



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply