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

Attaching new database on SQL 7 1

Status
Not open for further replies.

Balarao

MIS
Jun 9, 2003
25
PH
Hello,

I am new in SQL Version 7. I installed in my stand-alone computer a copy of the desktop edition.

How can I attach my database in SQL. I can't see any attach command in the menu unlike the ones I've see in SQL 2000.

Thank you so much for your help...

Balarao
 
Look up sp_attach_db in BOL. I don't think there's much difference, if any, between 7 and 2000.

--James
 
The attach and detach commands aren't available in SQL 7's Enterprise Manager. You have to run the commands via Query Analyzer. The commands are sp_attach_db and sp_detach_db.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Hello,

I still can't attached my database. :(

I tried executing this command:

EXEC sp_attach_db @dbname = 'Sample1',
@filename1 = 'D:\My Project\Sample Data\SFES_Data.mdb',
@filename2 = 'D:\My Project\Sample Data\SFES_Data.ldf'

I am getting this error:

Server: Msg 5105, Level 16, State 4, Line 1
Device activation error. The physical file name 'D:\My Project\Sample Data\SFES_Data.mdb' may be incorrect.

There's a remark in the T-SQL Help:
sp_attach_db should only be executed on databases that were previously detached from the database server using an explicit sp_detach_db operation.

The file that I am attaching is new. Please help.

Thanks again.

Balarao
 
You can only attach an existing database that you have previously detached from a server.

If you are just creating a new database then you need to use CREATE DATABASE. Check BOL for full syntax.

--James
 
Dear James and all,

I am developing a system using MS SQL 7 as the database. I am creating the system and the MS SQL 7 databases in my home computer.

How can I attach my created MS SQL 7 Databases in the user's computer? Some of the databases I created at Home have numerous records in it already. Does this mean I have to create the same database in the user's computer and input all the records again? Is there a way to attach the databases in the user's computer directly?

Thanks for the help.

Balarao
 
Why do you not just create a shell database on the user's computer first w/ the same name as the DB you are trying to detach and attach from yours currently.

Then just do a full Backup of your DB and use that backup file to Restore it over the user's DB on his system.

Then both the systems w/ mirror each other.

Thanks

J. Kusch
 
Dear JayKusch,

Yes I will try just that! Thank you so much...

What I did was to export my SQL database to MS Access and will try import it to the user's computer. What I'm worried about are the compatibility of both database engine. Will tell you how it goes. Hope this also works.

Thanks again...

Balarao
 
You are not able to mix and match database files in SQL Server and Access for an FYI

Thanks

J. Kusch
 
Dear JayKusch,

It did work! I've been using the imported files for a week now and everything seems fine.

Thanks to all!

Balarao
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top