SQL Server recovers deleted data from delete

Source: Internet
Author: User


Recovering deleted data from delete


A chance I saw the recovery of SQL Server deleted data by mistake Blog

The original address is: http://www.cnblogs.com/lyhabc/p/3683147.html


I was very curious to see the next, and then is confused, completely do not understand. I'm not actually going to

This blog post to understand, since the others have been developed, directly to use the line.


Then I just tested it and found the following questions


1. The author in the blog says that the datetime type is supported, the result of the test is completely wrong, and the date is incorrect.

2. The data recovery method does not support the date type.


Then I groped myself to modify the SP written by the author, fix the above two problems.


When system_type_id = 61

Then convert (VARCHAR (MAX), convert (DATETIME, convert (VARBINARY (8000), substring (CONVERT (VARBINARY (8000), REVERSE ( Hex_value)), 4, 1) +

SUBSTRING (CONVERT (VARBINARY (8000), REVERSE (Hex_value)), 3, 1) +

SUBSTRING (CONVERT (VARBINARY (8000), REVERSE (Hex_value)), 5,4)),--datetime

When system_type_id = 40

Then convert (VARCHAR (MAX), convert (DATE, convert (VARBINARY (8000), Hex_value)), 23)


When CONVERT (INT, SUBSTRING (Hex_value, 1, 1)) = 61

Then convert (VARCHAR (MAX), convert (DATETIME, convert (VARBINARY (8000), REVERSE (SUBSTRING (hex_value,3, LEN (Hex_value) )) (--datetime))

When CONVERT (INT, SUBSTRING (Hex_value, a)) = 40

Then convert (VARCHAR (MAX), convert (DATETIME, convert (VARBINARY (8000), REVERSE (SUBSTRING (Hex_value,3,len) )) (--date))


This is the code that I modified.


This article is from the "SQL Server MySQL" blog, so be sure to keep this source http://dwchaoyue.blog.51cto.com/2826417/1566483

SQL Server recovers deleted data from delete

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.