Questions tagged [attach]

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

Filter by
Sorted by
Tagged with
-1 votes
1 answer

SQL Server: attach database with filestream error 5

I'm trying to attach a database with full text catalog and filestream, but I'm having some issues with the file stream part. Here's the SQL I'm using (according to this article, this should work): use ...
Luis Abreu's user avatar
1 vote
1 answer

How to move mdf file to other disk drive when it is "Standby / Read-Only" mode?

I am trying to change the location of mdf and ldf file from one disk drive to other disk drive due to storage limit. Currently, the database that I am trying to move to other drive is in "Standby ...
Java's user avatar
  • 213
0 votes
0 answers

CREATE FILE encountered operating system error 5 (Access is denied.) while attempting to open or create the physical file

(I reviewed the comments from this post, but I was not able to resolve my issue). I am trying to attach a mdf file that I placed in other drive, and I got this error: I am aware of the permission ...
Java's user avatar
  • 213
0 votes
1 answer

How to remove remaining traces of a detached database from a server?

I had a database Coderr that I no longer wanted. Unfortunately, I detached it instead of dropping it. Now I'm seeing traces of it pop up in SSMS dialogs: I'd like to remove this (and any others that ...
InteXX's user avatar
  • 549
2 votes
0 answers

How do I fix the Failed to retrieve data for attaching mdf file is which not primary database file

I'm using SQL Server 2019 in Windows 10 Enterprise and Administrator user I have an MDF file and I want to attach it, and it has full access in the form of Everyone Full Control , when I try to attach ...
Mojtabah's user avatar
0 votes
1 answer

DB2: Working with concurrent DDL operations

We are working on a data warehouse using IBM DB2 and we wanted to load data by partition exchange. That means we prepare a temporary table with the data we want to load into the target table and then ...
user2323596's user avatar
0 votes
1 answer

What is the implication at attempting an attach without detach?

Sql server attach prerequisite states that a db must be detached before trying to attach it to another instance (
variable's user avatar
  • 3,350
0 votes
1 answer

Missing rows in table after restore database from MDF and LDF with SQL Server 2008

I have got two files, test.mdf and test.ldf, with sizes around 200 Mb and 200 MB. I restore the database using "Attach Databases" options, all is ok, but I found that there are a lot of ...
dlopezgonzalez's user avatar
0 votes
1 answer

Attaching database to an existing connection

Is attaching the database supported only by SQLite and MS SQL Server? All other DBMSes can only have one database per connection? Scenario: Let's say there is an archived database with some historical ...
Igor's user avatar
  • 217
0 votes
1 answer

attach csv file on email sent from postgres

I have the following code to send emails and wanted to see if it's possible to attach a csv file? CREATE OR REPLACE FUNCTION public.send_email_html(text, text, text, text) RETURNS integer LANGUAGE ...
Matias's user avatar
  • 131
0 votes
0 answers

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\...
isxaker's user avatar
  • 67
0 votes
1 answer

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 ...
LearnByReading's user avatar
0 votes
1 answer

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 ...
yvr238's user avatar
  • 99
0 votes
1 answer

Attach database

SQL express 2016 How to attach database (picture)??
Hung Nguyen's user avatar
2 votes
3 answers

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 [...
Craig Efrein's user avatar
  • 9,630
2 votes
1 answer

Cannot re-attach SQL Server Express database to the same server after detaching?

I migrated a database in a test environment from one server running SQL Server Express 2008 R2 to another running the full version of SQL Server 2012. I did that by detaching the database from the ...
DrCopyPaste's user avatar
1 vote
2 answers

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 ...
vcRobe's user avatar
  • 121
3 votes
3 answers

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 ...
user18139's user avatar
1 vote
1 answer

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 ...
Eirik H's user avatar
  • 113
14 votes
12 answers

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 ...
MxLDevs's user avatar
  • 329