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.
The local database has to be given a unique name with parameters from C# code, similar to
TodaysDate_SerialNumber_MachineNumber_DatabaseName
e.g. 20100622_1_3_DatabaseName
(Don't get caught up with the naming scheme, it hasn't been decided yet.)
I'm working in C# on .net 3.5 using VS2010.
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?
(Btw, if I'm being unclear, just let me know and I will try to update the question with more info.)