Sql-server – query Microsoft GP database and save the result as MDF file

sql serversql-server-2012

I have a request as below for auditing purpose on Microsoft Dynamic GP database.

  1. Database files are required as .mdf and .ldf files for certain companies
  2. Only need the certain period time of data, not entire database from day 1 till now

My questions:

  1. Is this even possible to provide only certain period time of activities from database as .mdf file? I mean if the .mdf file is required, it must be the entire database right?

  2. If it is possible, how? Query the database for everything happened in that period of time and save it as .mdf file and .ldf file? Or somehow somewhat cut the .mdf file? I don't think so…

  3. or if I provide entire database with only that period of transaction log?

I posted this question on overflow, It should be posted here.

Best Answer

The way to handle this is to create a new database with a different name (for example, MyDB_Export), then use the Export functionality in Sql Server Management Studio - right-click on the database in SSMS, and click Tasks / Export Data... on the pop-up menus. The only thing you will do is to specify a query to select the data to export to the new DB.

Its pretty intuitive to walk through the steps, so you should be able to work out how to complete this easily once you are in the Import/Export Wizard. If not, just add a comment below and I'll expand on this.