how to convert LSN format to numeric

  • If I do a query

    select first_lsn , last_lsn from msdb..backupset

    I get the LSN in numeric format

    the query

    use ; select * from fn_dblog(null,null)

    current LSN comes in hexa decimal format ,

    how can I convert this Current LSN format to numeric

  • pla reply guys

    I need it

    one more question

    can I convert the Numeric LSN ( like 251000000042000001) to decimal

    select * from fn_dblog(null , null)

    returns current_lsn as 000000fb:000001a4:0005 that is equal to decimal 250:420:5

    can I convert it into numeric LSn as I get from backupset table????

  • there is a function documented at


    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Thanks for your reply

    but I want to convert numeric LSN to decimal format not in binary

    what exactly my task is

    I get current LSN from fn_dblog that is in hexa decimal format

    and LSN from backup set table that is in numeric format

    so want to convert both LSN in a common format

    either from hexa to numeric or numeric to decimal

    as from hexa to decimal I can convert

  • try this...

    select convert(binary,251000000042000001),convert(numeric,0x00000000000000000000000000000000000012000001815E20912BBB7B03), convert(decimal,0x00000000000000000000000000000000000012000001815E20912BBB7B03)

    change value whatever you have.


Viewing 5 posts - 1 through 5 (of 5 total)

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