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.>
right-click on database from Management Studio -> Detach. Then you have the MDF file you can export to wherever you want :)