How To: Use Transact SQL (T-SQL) Editor for Queries
This topic describes how to use the Transact-SQL (T-SQL) editor by using Visual Studio. Transact-SQL editor is a stand-alone editor, which you can use without creating an application to author and execute database queries. You can connect to the sample database of SQL Server Compact or create a new database and manage the data. For more information, see Visual Studio Transact-SQL Editor.
To run queries using Transact SQL Editor
Open Visual Studio 2010 Service Pack 1.
On the Data menu, point to Transact-SQL Editor, and then select New Query Connection.
In the Connect to Server dialog box, select Server type as SQL Server Compact.
Browse to Northwind.sdf in the Database file. Click Connect.
A Transact-SQL Editor session opens, from which you can modify, validate, and save your database object or script.
When the path to the database file is specified, the version of database file is auto-detected. Depending on the version of the file, either SQL Server Compact 3.5 or SQL Server Compact 4.0 runtime engine is used to connect to the file.