I want to create a database in SQL from .mdf file present in a temp location say C:\Temp
I am using the following query
USE [master]
GO
CREATE DATABASE [database_name] ON
( FILENAME = N'C:\temp\temp.mdf' ),
( FILENAME = N'C:\temp\temp.ldf' )
FOR ATTACH ;
GO
But I want the mdf and ldf files to be copied to the SQL default path(C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Data\) on attaching, as the temp location may get deleted or changed in the future.
How do I do this?