Friday, September 30, 2011

Analyzing SQL Server Compact queries using Visual Studio 2010 Premium/Ultimate

f you are the happy owner of Visual Studio 2010 Premium or Ultimate, there is a hidden tool that allows you to run and analyze queries against SQL Server Compact 3.5 and 4.0 databases. (Support for 4.0 requires Visual Studio 2010 SP1 + the SQL Server Compact Tools update). This blog post will walk through how to access and use this “hidden” tool.

NOTE: If you only have Visual Studio Professional, you can use my SQL Server Compact Toolbox in combination with the free SQL Server 2008 R2 Management Studio Express to perform similar query analysis.

To access the tool, go to the Data menu, and select Transact-SQL Editor, New Query Connection… (The tool is part of the so-called “Data Dude” features)

clip_image002

In the Connect to Server dialog, select SQL Server Compact:

clip_image004

You can select an existing database, or even create a new one. This dialog will automatically detect if the specified file is a version 3.5 or 4.0 file.

clip_image006

Once connected, you can perform functions similar to what you may know from SQL Server Management Studio:

clip_image008

clip_image010

No comments: