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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

data files

Status
Not open for further replies.

joeythelips

IS-IT--Management
Aug 1, 2001
305
IE
Hi,

I am new to sql server but i have to do the following:

I have been given a cd with 16 .mdf data files from an external vendor.

I want to put these files into a sql server database.

There is no current database for these files i.e i will have to create a new one.

Can someone point me in the best direction for this please.

Thanks

 
First, an .mdf file is a data file. It is the database. So you can't put all 16 into one database, they are 16 databases.

What you need to do is install SQL Server (if you don't already have it installed). Then open up Enterprise Manager. On the left window in EM, drill down until you see the databases (Master, MSDB, etc.). Insert the disk with the .mdf files. On the SQL Server Instance name, right click and select ATTACH DATABASE. Browse to find the database (.mdf) file that you want to attach. Attach it. Then do the same thing for the other 15 databases.

Refer to the BOL for more information on Attaching Databases.

-SQLBill

BOL=Books OnLine=Microsoft SQL Server's HELP
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine

Posting advice: FAQ481-4875
 
Thanks SQLBill

Is it possible to merge all the data files together as i will be getting new files every month

Joe
 
What do you mean by merging them together?

Basically the answer will be no. They are 16 different, complete databases. They may not have anything in common, so they probably can't be merged into one. And when you get the new disk, it's 16 complete databases again. So they can only be attached, not merged. They will probably have the same names as the initial 16 so you will have to overwrite the originals.

What is the purpose of this? What are you and the originator trying to accomplish? (Maybe we can give you better ideas).

-SQLBill
 
SQLBILL,

in order to fully answer your question i will need to go back to the vendor.

I will get back to you asap.

Thanks again for your help
 
Hi,

I can clarify now the situation.

there are 10 separate databases for which i will receive a backup every month with the previous months data.

the backup will be in the form of an .mdf file.

Am i correct in saying that given this, the number of databases i have will increase by ten every month?

is there a way to merge the new information into the previous months database?

Would i be better asking for an export dump rather than getting an .mdf file?

Hope this makes sense.

Joe
 
Also,

when i try to attach the 2nd of the ten databases, i get an error saying that 'the data file name i am trying to attach may be incorrect'

Joe
 
when i try to attach the 2nd of the ten databases, i get an error saying that 'the data file name i am trying to attach may be incorrect'

Do the .mdf files on the disk have different names?

As for each new month...I can't think of an easy way to merge the data. I think I would rename the file, attach it with a new name (ie. Junedata). Then do a INSERT INTO maindb_name FROM JuneData. Check out the BOL for information on INSERT INTO.

Normally, you would start with a database (attaching it from .mdf, restoring it from a backup, whatever). Then you would add only transaction logs to maintain ongoing data changes. But you can't do that by attaching (using .mdf and .ldf files). It has to be done by using BACKUP files. Reference material: BOL-read up on Replication (transactional replication, merge data, and log shipping).

What is the purpose of what you are doing?

-SQLBill

BOL=Books OnLine=Microsoft SQL Server's HELP
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine

Posting advice: FAQ481-4875
 
The .mdf files have different names.

the purpose of what i am doing is to have data from our windfarms available to users for reporting through access
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top