Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Edit .mdf file will it work?

Author  Topic 

Directlinq
Starting Member

8 Posts

Posted - 2009-10-13 : 01:38:17
Hi can anybody help me.
Im a complete newbie at this so go easy. My friend has a database on an sql server on his computer. If i copied the .mdf and .ldf file from his computer and copied it to mine, and i installed an sql server 2005 with SQL Server Management Studio Express Edition. If i attached his .mdf file to my sql server and added some data entries into the tables and then saved it. If i then put it back on his computer would he be able to carry on using that database with my info in it as well and would he be able to see my info?
Or would it corrupt the database

I hope that made sence?
Many Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-13 : 01:40:10
You should move databases around between machines using backup/restore. It is much safer than detach/attach.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Directlinq
Starting Member

8 Posts

Posted - 2009-10-13 : 01:41:55
Thank you i will look into that
But would it work with the attach and detach?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-13 : 01:42:18
Yes, but you could end up with a corrupt database. That's why backup/restore would be safer.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Directlinq
Starting Member

8 Posts

Posted - 2009-10-13 : 01:45:09
Sorry to be a pain but how is a backup done? On his computer he has a piece of software controlling his database. It does not have backup or restor function in it. How can this be done?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-13 : 01:46:35
It would be done inside SQL Server Management Studio or some other software tool that allows you to run T-SQL.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Directlinq
Starting Member

8 Posts

Posted - 2009-10-13 : 02:03:35
Thank you for all your help
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-13 : 13:14:47
You're welcome.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-10-14 : 15:46:33
It wouldn't corrupt if you have properly detached/Stopped SQL Services before moving mdf/ldf files.
Go to Top of Page
   

- Advertisement -