Sunday, March 25, 2012

Attach database

I have a database on a server and want to put it my local laptop that also has sql express. I attached the db, I see it in Management Studio but it does not show up in

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data so my app is not working correctely. How do I get the db to show up in the MSSWL\Data folder. I'm a bit confused.

Attaching a DB to SQL Server does not move the DB file. If you want the DB file to be in a particular directory then you need to move the file to that directory and then attach the DB file to SQL Server.

|||Ok I copied the db to the data folder and then attached it. I can connect but but I get an error "connot find server\instance.|||Then it has nothing to do with the directory of the file. That means that what "MSSWL\Data" is the name of a "named" instance of Sql Server. In that case you will need to configure\modify the application so it can connect to the Sql Server installed on your machine. As it looks now the application is trying to connect to the server from where you got the database file.|||

Need some more info here, when are you getting this error? If you can't find the server, you are not able to connect as you suggest. A few other questions:

What is the name of your instance?
Have you confirmed that it's running in SQL Configuration Manager?
Are you able to connect from the local computer? (i.e. where Sql Express is installed.)

Thanks for the additional informaiton.

Mike

|||

I fugured it out. I put the db and dblog in the data folder and then attached it..it works fine now.

Thanks much

|||

Good to hear it's working.

Mike

No comments:

Post a Comment