I have created a database \"test\" with some tables in MS SQL Server 2008 R2 (i.e. MS SQL Server Management Studio).
Now, I need to export this database as a MDF file.>
If you are in Visual Studio, go to SQL Server Object Explorer. Find the database you want, right click and select properties. In the properties tab, look for Data File, next to it will be the location for your mdf file.