Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
'm trying to read the LOG file using the sql command fn_dblog based in one sequence of numbers ( LSN )

SQL
Select * from fn_dblog('00000203:00000085:0002','000000204:00000136:0010')


BUt, when I execute that command, I got an error, saying that the code is invalid... I did some studies based on this site[^] about LSN and log files... but, or I got an error, or, when I execute the command with the two NULL parameters, I just got 2 rows of informations... I considerate that is intresting, because, when I use a program to read the data-log, I got all the information's.

How I can make to read all OLD data and information of log using SQL, to compare with new information in database ?
I know, have some programs make that, like ApexSQL LOG and mdfview, but, I want to know, how to make this in SQL or, how I can make this in C#.

If you see in picture, that program return the new and old information, after update in row.
Image[^]

So, that program get the information from *_LOG.ldf file and compare with *.mdf file to show the new and old value.
I tryed this[^] too... but, the first SELECT return nothing...

So, how I can make to read that informations, old and new information from database ? ( the most important is the old information, for I can compare the data )

Thanks.
Posted

1 solution

SELECT * FROM fn_dblog(NULL, NULL) returns all the logs. The two params you pass in are the log sequence numbers you want entries between. This is what happens when you use code off the internet and don't take time to understand it.

This[^] seems like a good overview.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900