• Are you sure that you have got all data files from the original db? Are you sure that your .mdf and .ldf files come from the same db? If the latter is not true, you can try attach only mdf file and new log will be created for you by sql server. If a datafile(s) is missing you should get a complete set of files and start again. If it's not possible you can try these steps to salvage your data:

    we've got only primary data file, all secondary files and log files are lost

         sp_attach_db doesn't work because it looks for all files that originally comprised db

             a) backup the file before going any further

             b) rename the file to filename_old

             c) create new db that has one file of the same physical name and size as our file

                (logical name of the file and name of db can be different from original)

             d) stop Sql server

      e) replace original file for mdf file of newly created db

             f) start SQL server

             g) in SQL Server logs are messages 'Log file does not match the primary file.',

                'Cannot associate files with different databases.' and db is suspect

             h) Set database in emergency mode:

     

                sp_configure 'allow updates', 1

                reconfigure with override

                go

                update sysdatabases

                set status = 32768

                where name = 'db_name'

                go

                sp_configure 'allow updates', 0

                reconfigure with override

                go

             i) Now Data should by accessible - Export data out of the database using bcp or DTS

             j) drop db created in step c