SQL Server 2016 - We have two files - one mdf on Primary and one ndf on Secondary filegroup.
We want to move data from secondary to primary and then delete secondary:
Approach 1: Create clustered index on table which are on secondary and setting location of index to primary (Question: is clustered index only option or non clustered index will work too) Approach 2: DBCC SHRINKFILE (nameofdatafile, EMPTYFILE); GO -- Remove the data file from the database. ALTER DATABASE AdventureWorks2012 REMOVE FILE Test1data; GO
But files are in different file group, will above works