Opening SQL Server Compact Files

Today I am taking a look at some code someone else developed.  They used SQL Server Compact database files (.sdf), which I have read about but never personally used.  I went on a little journey to simply open the file and see what is inside.

Of course, my first assumption was, “Use SQL Server Management Studio.”  Alas, the file would not open in neither SSMS 2008R2 nor SSMS 2010.  After Googling for a little bit, I realized Visual Studio was the place to go.  All I needed to do was install the SQL Server Compact Toolbox:

  • Open Visual Studio 2010
  • Click Tools >> Extension Manager
  • Click Online Gallery and search for “SQL Server Compact”
  • Click “SQL Server Compact Toolbox” and Download
Then, to open the .sdf file, I had to
  • Go to the Server Explorer section
  • Add a new connection
  • Change the data source to Microsoft SQL Server Compact X.X (in my case 3.5 worked)
  • Find the database using “Browse” and test the connection
And there it was!  Now I can explore the data tables as I expected to.  Now to see how this program works…

Leave a Reply

Your email address will not be published. Required fields are marked *