title: How to programmatically extract SQL Server table schema to construct SQL Server CE?
body: <p>As stated in the title, how can I programmatically create a SQL Server CE 4.0 from a remote SQL Server?</p>
  
  <p>I want my application to allow users to delete the <code>.sdf</code> and create a new one based on the new remote database schema when there is a database schema update. And then download relevant data for offline use.</p>
  
  <p>I already read up about the <code>SqlCeEngine</code> part, but I am not good at SQL Server CE queries - seem to give many syntax errors when trying out in Management Studio.</p>
  
  <p>I also tried Microsoft Sync Framework Snapshot synchronization but it feels too bulky and the Local Cache Database modifies my database schema and generates a lot of junk I do not need. Maybe a lower level solution like querying information.schema or something may work better?</p>