Recently, I was working for a client, and I was supposed to create an in-memory table for the performance perspective. However, I got this error when I tried to create the in-memory table. You can see the same error in the screenshot below.
Check out How To Create A Table Valued Function In SQL Server
Solution
I followed the below steps to fix this issue.
1. The first step is to create a file Group using the below query.
ALTER DATABASE Test ADD FILEGROUP Test_mod
CONTAINS MEMORY_OPTIMIZED_DATA;
2. Now, we can use the below query to add DatabaseFile to your file group.
ALTER DATABASE Test ADD FILE (
name='Test_mod', filename='c:\Data\Test_mod')
TO FILEGROUP Test_mod;
After that, I executed the same SQL query again, and this time, the query was executed successfully, as shown in the screenshot below.
Conclusion
To fix this error, we need to create a file Group and add DatabaseFile to your file group, as mentioned in this article.
You may also like following the articles below.
- Saving Changes Is Not Permitted SQL Server
- An Explicit Value For The Identity Column In Table
- Incorrect Syntax Near The Keyword ‘Order’
- Cannot set SYSTEM_VERSIONING to ON when SYSTEM_TIME period is not defined.
Grey is a highly experienced and certified database expert with over 15 years of hands-on experience in designing, implementing, and managing complex database systems. Currently employed at WEX, USA, Grey has established a reputation as a go-to resource for all things related to database management, particularly in Microsoft SQL Server and Oracle environments. He is a Certified Microsoft SQL Server Professional (MCSE: Data Management and Analytics) and Oracle Certified Professional (OCP), with Extensive database performance tuning and optimization knowledge and a proven track record in designing and implementing high-availability database solutions.