locked
SQL Server Query Suggestion RRS feed

  • Question

  • User1623409651 posted

    Hi,

    I have multiple tables like

    1. Experience
    2. Honor and Awards
    3.  Memberships

    With datetime LastUpdatedon feild Now i have to reterive the last udapted in particular table

    Like

    LastUpdated on ,  Table Name
    05-JAN-2018   Expereince ,Membership

    Please suggest the way

    Thanking you

    Wednesday, January 10, 2018 6:58 AM

All replies

  • User726159118 posted

    Hi Rameez ,

    you can use derived table for both table combined derived tables using join and finally write select statement for fetching records.
    So from indivisual you can select lastupdated records with respective column and use this column at uppar select.

    Regards,
    Omkar.

    Mark As Answer If it helps.

    Wednesday, January 10, 2018 10:17 AM
  • User347430248 posted

    Hi Rameezwaheed,

    you had mentioned that,"Now i have to reterive the last udapted in particular table"

    you can try like below.

    SELECT OBJECT_NAME(OBJECT_ID) AS DatabaseName, last_user_update,*
    FROM sys.dm_db_index_usage_stats
    WHERE database_id = DB_ID( 'demo')
    AND OBJECT_ID=OBJECT_ID('emp')

    Output:

    Reference:

    SQL SERVER – Find Last Date Time Updated for Any Table

    Regards

    Deepak

    Thursday, January 11, 2018 3:05 AM