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
 General SQL Server Forums
 New to SQL Server Administration
 Save tables as .MDF files

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2009-07-15 : 15:29:41
HI I have a need to save some tabels as .MDF

I don't see anywhere on this site what is the command to do this. like "Backup"

If someone can post the syntax to make this happen please do.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-15 : 15:39:29
I think there is a misunderstanding.
SQL Server stores all relevant data in files called *.mdf there are no mdf-files to store a table.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2009-07-15 : 15:49:04
I am sure I am misunderstanding alot for sure.
one of the developers asked me to send her some tables. I did so using the "Backup" command or script.
She said she cannot attach them and that I should send the tables as .MDF but that I should make a copy and detach the copy.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-15 : 15:55:25
OK.
Detach the database so the mdf-file and the ldf-file is free.
Give the copy to the developer and don't forget to attach your database then.

What is the help you need now?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2009-07-15 : 15:58:09
she said to right click and there would be a place for detach. but this is not so. no detach.
also she said to make a copy and detach the copy.
i don't see how to make this copy either.

I am only 3 weeks with SQL Server.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-15 : 16:00:51
So we start!
Do you use Sql Server Management Studio (short name: SSMS)?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2009-07-15 : 16:06:01
yes i go to the table and right click and i try to copy also but it merely renames it
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-15 : 16:16:05
The mdf-file isn't for only one table! It is for the whole database.
She wants you to give the whole database.
But FIRST you have to know the location of the files!
Right click on the database - choose option - choose file and note the location of the two files.

Ready?

Right click the database - choose all tasks - choose detach database.

go to the location in file system to copy the two files you have noted before. Maybe the ldf-file isn't important but anyway...

When all this is done - reattach the database to your sql server because in this moment it is not ready to use for you.




No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2009-07-15 : 16:20:30
I see but it's a huge database, its' impossible to then email this.
This is Microsoft Dynamics. Maybe I am stupid but isn;t this too large to email to someone?

How come another fellow was able to use from the 'BACKUP" method, and she cannot?

Go to Top of Page

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2009-07-15 : 16:25:52
ok, detach i see. now you are saying that the copy will work better?
how do I do the copy then?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-15 : 16:26:44
Maybe she doesn't know how to restore a backup?

And I cannot see HOW large the database is and I don't know what is possible with your mail account...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-15 : 16:28:46
quote:
Originally posted by AdamWest

ok, detach i see. now you are saying that the copy will work better?
how do I do the copy then?


Open a new mail and attach the file(s) to the mail like you do with every other file to send via mail.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-07-15 : 23:25:50
I wouldn't detach a production database for somebody. I'd send 'em a backup. If they don't know how to restore, send em this link: http://msdn.microsoft.com/en-us/library/ms186858.aspx
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2009-07-16 : 10:31:39
quote:
Originally posted by russell

I wouldn't detach a production database for somebody. I'd send 'em a backup. If they don't know how to restore, send em this link: http://msdn.microsoft.com/en-us/library/ms186858.aspx



Should the developer be responsible for restoring the database or should someone else? You need to determine who plays what role in the process and ensure that the appropriate person is doing the work. Rarely have I had a developer doing a restore, but that's just me. They get paid to develop, I get paid to take care of the back-end....

Terry

-- Procrastinate now!
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-07-16 : 14:55:30
While I agree with that, if the OP is emailing the data files to somebody, I assume that they've already resolved that internally.

To copy the data files, you need to either detach the db or stop the SQL service. I wouldn't do that when I could just send a backup. Also seems very unlikely that somebody capable of attaching data files is not capable of restoring a backup.
quote:
Originally posted by tosscrosby

quote:
Originally posted by russell

I wouldn't detach a production database for somebody. I'd send 'em a backup. If they don't know how to restore, send em this link: http://msdn.microsoft.com/en-us/library/ms186858.aspx



Should the developer be responsible for restoring the database or should someone else? You need to determine who plays what role in the process and ensure that the appropriate person is doing the work. Rarely have I had a developer doing a restore, but that's just me. They get paid to develop, I get paid to take care of the back-end....

Terry

-- Procrastinate now!

Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-07-16 : 14:58:16
also can't help wondering who needs a copy of your accounting data...

i see all kinds of red flags
Go to Top of Page
   

- Advertisement -