Forum Discussion

showman's avatar
showman
Copper Contributor
Nov 08, 2023

Read insert/update/delete queries from SQL transaction log file

Read insert/update/delete queries from SQL transaction log file. I am using to read fn_dblog function , using this function I could see only transaction name only not read transaction queries. I think there some 3rd party tools they have read that in the same way I want to read that transaction queries. In log shipping restore job read that transaction log file and restore the data in to secondary database  tables. I want to know how to read that DML operation from Transaction log (.ldf) file.

  • olafhelper's avatar
    olafhelper
    Bronze Contributor

    showman 


    I could see only transaction name only not read transaction queries. 

    SQL Server don't log the queries, only data changes; so you can't get it.

    You have to implement a DML logging.

    • showman's avatar
      showman
      Copper Contributor
      I want to read that changes from .ldf file ? How? with out CDC and Triggers?
      • olafhelper's avatar
        olafhelper
        Bronze Contributor
        The function fn_dblog exists, but the usage is not supported and so there is no supported way to get data from transaction log.

Resources