Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Attach Single File (MDF) Problem

Posted on 2004-03-22
4
2,275 Views
Last Modified: 2009-04-01
Hey,
I got sent a mdf file that i need to attach to my sql server (2k).
I thought this would be pretty stright forward but it looks like i was worng. I am not a guru in SQL or server admin but i have gotten along decently in the past.

I try to attach using this command
exec sp_attach_single_file_db @dbname = 'cadi_4_13'
, @physname = 'c:\cadi_4_13.mdf'

and i get this error message:
Server: Msg 5172, Level 16, State 15, Line 1
The header for file 'c:\cadi_4_13.mdf' is not a valid database file header. The FILE SIZE property is incorrect.

I have seen several places where people have this issue.
I am running sqlserver 2k.

Can someone please take me through (step-by-step) what exactly i am "susposed" to be doing?
I am actually running that in the Query analyzer, but i have tried a stored procedure and to generate a sql script, but i dont know how to execute them except for in a job.... I hope you see where my level is in the matter :)

Thanks in advance for your help,
Chris
0
Comment
Question by:hudsonbeck
  • 2
  • 2
4 Comments
 
LVL 34

Expert Comment

by:arbert
ID: 10649924
Two possible reasons.

1.  You're trying to attach this file to a different version of SQL Server than where it came from (even a hotfix makes a difference).
2.  The file you received was corrupt
0
 

Author Comment

by:hudsonbeck
ID: 10649987
SOmeone sent it to me so i really dont even know what version... I tried 97 and 2k.. but if even a hotfix can make it not work, what would be the best way for them to send me the db so i can "attach" it to my sql server. We will be doing some work on the data for them.

Chris
0
 
LVL 34

Accepted Solution

by:
arbert earned 500 total points
ID: 10650635
They need to tell you what version....Either that, or have them send you a backup that you can restore.  At least with a backup file you can issue a restore command that will tell you the version it was created with....
0
 

Author Comment

by:hudsonbeck
ID: 10713548
sry had a unexpected trip... accepted anwser and i appreciate ur help

Chris
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL: Get Holding Day Based On Transfer Date And Return Date 13 74
sql, case when & top 1 14 29
Database Integrity 1 50
MS SQL + date 6 23
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question