Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open SQL Database on another PC

Status
Not open for further replies.

Omkar158

Programmer
Jul 28, 2003
6
IN
Hi,
I am created SQL database on my pc & working successfully. Now I copy that files ( .mdf & .lof ) on cd & I want to open that files on another pc.
Can I open?
Please Help me.
Thank you.

 
At first, make sure, that they are not readonly.

Then in query analyzer use:
(At FILENAME = ... put the path to your mdf file)

CREATE DATABASE your_database
ON PRIMARY (FILENAME = 'c:\program files\microsoft sql server\mssql\data\your_database.mdf')
FOR ATTACH


Or you can do it in enterprise manager, right click on Databases, then All tasks and Attach database. Ckick on [...] (browse) and find your mdf file.

Zhavic

---------------------------------------------------------------
In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
 
Dear Sir,
Thankyou for your reply.
I am using SQL-7 and there is no option of Attach Database in enterprise manager.
Another method - 'CREAT DATABASE....' SQL throw the error message
'sever: Msg 5172, Level 16, State 15, Line 1'
"The header for file 'c:\MSSQL7\Data\Milind.mdf' is not a valid database file header. The PageAudit property is incorrect."
Can I use the latest version of SQL?

omkar158


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top