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