title: How to do a partial copy of a remote SQL Server Express database to a local SQL Server Express database?
body: <p>I'm in a situation where I need to create a partial copy of a database from a remote SQL Server (2005/2008 Express Edition) and store it in a local SQL Server (2005/2008 Express Edition) database. The local copy will have the same schema definition, but contain only parts of the data from the remote database. </p>
  
  <p>The local database has to be given a unique name with parameters from C# code, similar to</p>
  
  <pre><code>TodaysDate_SerialNumber_MachineNumber_DatabaseName    
  e.g.  20100622_1_3_DatabaseName
  </code></pre>
  
  <p>(Don't get caught up with the naming scheme, it hasn't been decided yet.)</p>
  
  <p>I'm working in C# on .net 3.5 using VS2010.</p>
  
  <p>My thoughts so far is to execute the create script for the database on the local SQL server from C# code, and then copy data from the remote database to the local database, filtered on what I actually need. The operations have to be started from C# code, but doesn't necessarily need to be all C# code. But I haven't decided yet. What do you think would be the best option for doing what I want to do?</p>
  
  <p>(Btw, if I'm being unclear, just let me know and I will try to update the question with more info.)</p>