Copying mdf file to a new folder at the end of the year programmatically

I am new to sql server . I have created a database named FAS in the instance of sql server 2008 express . I need to place FAS.MDF in the folder App_Data\2015 and deploy my ASP.NET website to the server.
Next year a new folder should be created (App_Data\2016) and FAS.MDF should be copied there. Can this be achieved programmatically in ?

Please help




  1. once you place FAS.MDF in the new folders, how will you access it?

I would like to attach this mdf file to the sql server instance running on the production server . I might have to give different names to the mdf files like fas15 , fas16 , fas17 etc for each folder created

Your goal appears to be to keep the data for each year segregated from data for other years (or something along those lines). This is a problem that a lot of users have, and there are well-established patterns for doing this type of thing. Copying the MDF file and attaching that to the database is not the recommended way. In fact, doing it that way will bring along with it a number of problems.

Search for "archiving data in SQL Server" or similar phrases, and you will find plenty of examples and guidance. Here is one, for example