locked
How do I recover data? RRS feed

  • Question

  •  

    I create a database called VijayDB, create a table called TestTable, and populate the table with some fictitious data: 

    SET NOCOUNT ON 
     
    CREATE DATABASE VijayDB
    GO 
     
    USE VijayDB
    GO 
     
    CREATE TABLE TestTable

        id INT PRIMARY KEY,  
        relID INT 

     
    SET NOCOUNT ON 
     
    INSERT TestTable VALUES(1, 1) 
    INSERT TestTable VALUES(2, 5) 
    INSERT TestTable VALUES(3, 3) 
    INSERT TestTable VALUES(4, 2) 
    INSERT TestTable VALUES(5, 7) 
    INSERT TestTable VALUES(6, 9) 
    INSERT TestTable VALUES(7, 4) 
    INSERT TestTable VALUES(8, 5)

     

    Now let's say I've thrown away the table or file that showed me those relationships of id <-> relID and allowed me to create the above INSERT statements. I've also closed this Query Analyzer window, so I can't even recover the script I used to populate the table. (Pretend, for a moment, that the script was too long to be memorized.) 

     

    So now, I want to UPDATE one row, and I open a new Query Analyzer window and say: 
     

    UPDATE TestTable  SET relID = 5

    After I hit F5, I realize: oh dear, I forgot to add a WHERE clause. I just updated all of the data in my table! I wasn't in a transaction, so I can't roll back. I don't have a backup, so I can't restore. What do I do? 

     

    Don't Suggest me to use Third Party Tools. I have to Solve this problem using T-SQL statements or else using SQL server Enterprise Manager Only.

    Even I have not used any Transactions and also not used any Backup files also.

     

    can u plz tell me how can i Retrieve the lost data.

     

    Thanks & regards

    Vijay Kumar.D

    Wednesday, July 9, 2008 11:05 AM

Answers

All replies