My mdf file was deleted. I was able to restore the said file but unfortunately I can no longer open it.
I have also noticed that the recovered mdf file was smaller than the file before it was deleted.
What can I do to open the database file I have tried the following lines using osql utility.
1> use db1sql1
2> go
Msg 946, Level 14, State 1, Server JDI11-31, Line 1
Cannot open database 'db1sql1' version 525. Upgrade the database to the latest version.

Cannot open database
Gaj?tko
qrt999
Chris Moughan
I got the following message upon execution of sp_attach_db.
Msg 5180, Level 22, State 1, Server JDI11-31, Line 1
Could not open FCB for invalid file ID 0 in database 'db1sql1'.
Converting database 'db1sql1' from version 525 to the current version 539.
Database 'db1sql1' running the upgrade step from version 525 to version 526.
boisebiker
P R W
porov
idoOv
So what's happened is that a page in the database has a corrupt page header, such that the next-page pointer has a 0 in the file-ID part of the pointer. 0 is an invalid file number and so the upgrade process has to terminate.
There's nothing that can be done at this stage (documented or undocumented) unless you have any SQL Server backups - sounds like you had a file system backup
Anpiro
Msg 1801, Level 16, State 3, Server JDI11-31, Line 1
Database 'db1sql1' already exists.
Unfortunately, upon executing "use db1sql1" I got the following message:
Msg 946, Level 14, State 1, Server JDI11-31, Line 1
Cannot open database 'db1sql1' version 525. Upgrade the database to the latest
version.
Is there a way I can transfer the database data into new database
mjt
No - as I explained before, the database isn't accessible because the corruption is preventing the upgrade steps from completing. This means that no SQL Server tools can connect to the database.
Your only recourse in this case is to restore from a backup.
THE RAZI
werd123
After the message about going from 525 to 526 did it stop or print anything else