restore SQL table contents?

snooper

Perch
Hi There

I mistakenly emptied all the contents of one table in an SQL database.
is there anyway to restore it - even if it is yesterday's row data?

Thanks!
 
The way I've done this (although not at JodoHost) is to restore the whole db to another db. Then do some SQL to copy the data across.

If the two dbs are on the same machine then you can include tables from them both in the same SQL statement by fully qualifying the table names with the db name, ie something like db.owner.table. I'm not sure how that will work on JodoHost, you'll need a SQL login that has access to both dbs. That shouldn't be to hard for support to arrange temporarily.

The SQL will be something like:

INSERT INTO OriginalDB.dbo.MyTable
(Field1, Field2, Field3 ...)
SELECT Field1, Field2, Field3 ...
FROM RestoredDB.dbo.MyTable

You may have some "fun" if the table has an identity / autonumber field and they need to be restored to the same values as before. There is a way of overriding the auto numbers although I'm not sure what permissions you need for that

Good luck ...
Ross
 
Back
Top