5

I have a SQL Server 2016 database and I configured in-memory table. I want to drop this configuration, then I drop that table. When I want to delete that file and filegroup, I got following error.

USE [InMem_Test]
GO
ALTER DATABASE [InMem_Test]  REMOVE FILE [InMemFile]
GO
ALTER DATABASE [InMem_Test] REMOVE FILEGROUP [InMemFileGroup]
GO

Msg 41802, Level 16, State 1, Line 3 Cannot drop the last memory-optimized container 'InMemFile'. Msg 5042, Level 16, State 11, Line 5 The filegroup 'InMemFileGroup' cannot be removed because it is not empty.

7

Currently, the only way to remove Hekaton is to drop the whole database.

Probably not your first choice, but it doesn't look like Microsoft is willing to change course on that.

  • This link is now dead. – Blake Dec 18 '19 at 19:41
2

Microsoft has addressed this in SQL 2019.

Version: Microsoft SQL Server 2019 (CTP3.2) - 15.0.1800.32 (X64) Jul 17 2019 21:29:33

Please check this link.

In case link has gone, the syntax is this:

Filegroup Management – Remove File from filegroup

ALTER DATABASE [database] REMOVE FILE [symbolicName];

Sample:

ALTER DATABASE [MyDatabase] REMOVE FILE [InMemoryContainer]
GO

Filegroup Management – Remove Filegroup

ALTER DATABASE [database] REMOVE FILEGROUP [filegroup];

Sample:

ALTER DATABASE [MyDatabase] REMOVE FILEGROUP [DBMO.MOD];
  • 1
    Welcome on the site! Look, how nicer your answer looks now. :-) We have many formatting options and a well-formatted, easily comprehensible post results good reactions (upvotes, mostly). – peterh - Reinstate Monica Dec 18 '19 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.