sql-server-ce

Converting an SQL Server database to an SQL Server Compact database. And back...

Simple problem. I have an SQL Server database (MyData.mdf) and I want to convert it to a Compact database. (MyData.sdf) Just can't find the proper tool which can do this for me. And I would also be able to convert the compact database back to a regular SQL Server database... ...

Why is SQL Server Compact Edition missing from the list of server types in SQL Server Management Studio 2008?

I have both 'SQL Server Compact 3.5 Service Pack 1' and 'SQL Server Management Studio 2008' (SSMS) installed on my PC. In the past, I was able to select 'SQL Server Compact Edition' from the list of 'Server Types' in the 'Connect to Server' dialog within SSMS. This entry is now missing and I have not been able to restore it. ...

Running an application from an USB device...

I'm working on a proof-of-concept application, containing a WCF service with console host and client, both on a single USB device. On the same device I will also have the client application which will connect to this service. The service uses the entity framework to connect to the database, which in this POC will just return a list of na...

How to prevent SQL Compact DB to be erased?

Hi, I'm developing an applciation using SQL Compact database in Visual Studio 2008. When I start the application and run the process, the data is being loaded into database for few hours worth of few tens of megabytes. However, when I quite debugging, change something in code (not in DB structure), run the project again, the database is...

sql CE 3.5 pros and cons

Hi, Currently we are using xml files as local data store for our disconnected application, there is proposal to move to SQL CE database. Can some one with experience of SQL CE provide some pros and cons of using sql compact, for example data type support etc. As Central DB server we are using SQL Server2005. One of the requirement is ...

View all ntext column text in SQL Server Management Studio for SQL CE database

I often want to do a "quick check" of the value of a large text column in SQL Server Management Studio (SSMS). The maximum number of characters that SSMS will let you view, in grid results mode, is 65535. (It is even less in text results mode.) Sometimes I need to see something beyond that range. Using SQL Server 2005 databases, I often ...

SqlCeResultSet Problem

Hello, I have a SmartDevice project (.NetCF 2.0) configured to be tested on the USA Windows Mobile 5.0 Pocket PC R2 Emulator. My project uses SqlCe 3.0. Understanding that a SmartDevice project is "more carefull" with the device's memory I am using SqlCeResultSets. The result sets are strongly typed, autogenerated by Visual Studio 2008 ...

How do I select the first row per group in an SQL Query?

I've got this SQL query: SELECT Foo, Bar, SUM(Values) AS Sum FROM SomeTable GROUP BY Foo, Bar ORDER BY Foo DESC, Sum DESC This results in an output similar to this: 47 1 100 47 0 10 47 2 10 46 0 100 46 1 10 46 2 10 44 0 2 I'd like to have only the first row per Foo and ignore the rest. 47 1 100 46 0 100 44 0 2 Ho...

Microsoft Sync Framework - Local DB and Remote DB have to have the same schema?

When using MSF, is it implied in the technology that the sync tables are supposed to be 1-1? The reason I'm wondering is that if I'm synching from a SQL2005 database to a SQLCE, I might want the CE one to be a little more flattened out so I can get data out with a simpler SELECT statement (as CE does not support sprocs). For example, I...

How to use parameter with LIKE in Sql Server Compact Edition

I'm trying to parameterise a search query that uses the LIKE keyword with a wildcard. The original sql has dynamic sql like this: "AND JOB_POSTCODE LIKE '" + isPostCode + "%' " So I've tried this instead, but I get a FormatException: "AND JOB_POSTCODE LIKE @postcode + '%' " Edit: I guess the FormatException isn't going to be coming...

SQL CE: Limiting rows returned in the query

In SQL Compact Edition 3.5 , note that it is the Compact Edition I am talking about- Is there a way to limit the amount of rows to only 2? Something like using LIMIT or TOP. I really don't want to use anything with a SqlCEDataReader, or SqlCEResultSet. I want to do all the limiting in the query. Is this possible now? I have looked around...

Microsoft Sync Framework. Applying "Scope" to an existing SqlCe database

Is it possible to apply a DbSyncScopeDescription to an existing SqlCeDatabase? I'm trying to provision an existing database using a DbSyncScopeDescription built from this database. This is the code i'm using to test this out. This should give you an idea of what I'm trying to do. I get a SqlCeException on the last line with the mes...

SQL Server Compact Edition - Create Database Tables

Hi, I got it right to create a SQL Server CE database table using the code below: string connectionString = "DataSource=\"test.sdf\"; Password=\"mypassword\""; SqlCeEngine en = new SqlCeEngine(connectionString); en.CreateDatabase(); But how do I create my database tables and insert data? I've got the SQL created statements stored in t...

Nested SELECT clause in SQL Compact 3.5

In this post "select with nested select" I read that SQL Compact 3.5 (SP1) support nested SELECT clause. But my request not work: t1 - table 1 t2 - table 2 c1, c2 = columns select t1.c1, t1.c2, (select count(t2.c1) from t2 where t2.id = t1.id) as count_t from t1 Does SQL Compact 3.5 SP1 support nested SELECT clause in this c...

how to open sdf (sql server compact edition) file?

I have an SDF file and I would like to retrieve its schema and query it with some UI. How can I do this? I have no Visual Studio installed on the machine and I would like to install as little software as possible. ...

SQL Server CE 3.5 Merge Replication

Hi, I am working on an application that will connect to SQL Server 2005 when users are in the office, or it will connect to SQL Server CE 3.5 when users are on a laptop and out of the office. I have been reading up on Merge Replication to keep the two in sync, but am having a hard time finding anthing from start to finish (all the docu...

SqlCe Where clause problem

I have a simple sqlce database, trying to update a row in a table. The following command works: UPDATE ConsoleUsage SET TotalCircuits = 123 But the above command updates all rows, so what I want is this: UPDATE ConsoleUsage SET TotalCircuits = 123 WHERE Index = 912 The intent is to update a single row in the table. But this comma...

SQL Server CE in a multi user scenario - is this really, really stupid?

I am trying to use SQL Server Compact Edition 3.5 as a database backend for a sales application. There would be 3-4 installations of a Windows Forms application which would all (via LINQ2SQL) read from and write to one .sdf file located on a network share. My (pretty inextensive) testing has shown that this could be viable. Documentatio...

SQL Compact performance on device

My SQL Compact database is very simple, with just three tables and a single index on one of the tables (the table with 200k rows; the other two have less than a hundred each). The first time the .sdf file is used by my Compact Framework application on the target Windows Mobile device, the system hangs for well over a minute while "some...

Large scale Merge Replication strategy - what can go wrong?

Hi, I'm developing a piece of software that uses Merge Replication and SQL Compact on Windows Mobile 6. At the moment it is running on 5 devices reasonably well. The issues I've come up against are as follows: The schema has had to change a lot, and will continue to have to change as the application evolves. There have been various ...