So somebody setup sql server and you now want to move tempdb to another drive? Easy.

Fire up Query Analyser and run the commands:

ALTER DATABASE tempdb MODIFY FILE (name = ‘tempdev’, filename = ‘new-file-path‘)
ALTER DATABASE tempdb MODIFY FILE (name = ‘templog’, filename = ‘new-file-path‘)

Replace the new-file-path with the full path and filename you want to use. For example:

ALTER DATABASE tempdb MODIFY FILE (name = ‘tempdev’, filename = ‘D:Program FilesMicrosoft SQL ServerMSSQLDatatempdb.mdf’)
ALTER DATABASE tempdb MODIFY FILE (name = ‘templog’, filename = ‘E:Program FilesMicrosoft SQL ServerMSSQLDatatempdb.ldf’)

Then simply restart SQL Server, and delete the old tempdb files.