Is there a way to generate a sql statement for tables in sql server compact? same as for sql server express +?
Typically, you create a table (....) as output?
There is a Codeplex project that someone actually created functionality that allows you to script for databases of compact versions of sql server.
There is a tool for this. Check out http://www.antipodeansoftware.com/Home/Products This will iterate through the entire SQL server and write the entire table, view, stored procedure and UDF scripts to the local drive. Great for adding an SQL or DDL schema to the source control.
The SQLite & SQL Server Compact Toolbox plugin has versions for Visual Studio and SQL Server Management Studio. I successfully used the latest version to add columns and export the schema as SQL from SQL Server Compact Edition 3.5.
You can connect to SQL Server Compact Edition using SQL Server Management Studio (SSMS), which in turn allows the script to display all database objects.
Refer to: Managing SQL Server Compact Edition with SQL Server Management Studio
and then also How to create a Script