Questions tagged [attach]

Attaching existing database files to an existing DBMS instance (not performing a restore)

Filter by
Sorted by
Tagged with
0
votes
0answers
77 views

Why does a create database statement return values when called from C#?

I have the following database command: CREATE DATABASE [test1] ON (FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\test1.mdf'), (FILENAME = N'C:\Program Files\...
0
votes
1answer
161 views

Do I need to detach a database to attach it?

I am trying to move data from one SQL Server server to another (located on another computer). I know of the detach/attach method, but I don't want to disturb the prod environment (detaching a prod ...
0
votes
1answer
53 views

Detached database with renamed drive

I have detached a database and had the systems team rename the drive letter (from E: to P:). When I try to attach the database again, it's looking for the original drive. I don't have a backup of the ...
0
votes
1answer
77 views

Attach database

SQL express 2016 How to attach database (picture)??
1
vote
3answers
2k views

Generate CREATE DATABASE FOR ATTACH for all existing user databases

Does anyone have a TSQL script that can automatically generate the code necessary to attach ALL existing user databases using the CREATE DATABASE FOR ATTACH syntax? example: CREATE DATABASE [...
2
votes
1answer
394 views

Cannot re-attach SqlExpress database to the same database server after detaching?

This seems a bit strange. I migrated a database in a test environment from one server (SqlExpress) to another (full SqlServer). I did that by detaching the database from the first server, copying over ...
1
vote
2answers
257 views

Attaching a database (created in SQL Server 2012) to an instance of SQL Server 2014 without upgrading it

I've a database in a production server (SQL Server 2012) and I've a development server (SQL Server 2014). I need to attach the database in the development server but I've realized that once attached ...
2
votes
3answers
703 views

What is the purpose of attaching a database?

I always see this option called attach database in SQL Server. Why would someone attach a database? Why not just restore a database from the .BAK file? I guess I don't see the purpose of it. What ...
1
vote
1answer
4k views

Two SQL Server databases setup with same .mdf and .ldf files

In a SQL Server 2008 R2 instance two databases (the second one being a restore/copy of the first one) have been setup against the same .mdf and .ldf files. How would I go about either deleting the ...
8
votes
9answers
51k views

Database cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery

I have received a database file and the instructions for loading it is to install SQL Server 2005 and then attach it using SQL Server Management Studio. After installing everything, I tried to attach ...