SQL Server : Moving Database Files

Alter the metadata about the file.

USE master
GO

ALTER DATABASE MyDatabase
MODIFY FILE (
  NAME = N'MyNewDatafile',
  FILENAME = N'e:\db\MyNewDatafile.ndf'
)
GO

Take the database offline, move the physical file and bring the database online again.

ALTER DATABASE MyDatabase SET OFFLINE

-- Move the physical file.

ALTER DATABASE MyDatabase SET ONLINE