How to migrate from SQL Compact Edition (sdf file) to SQL Server 2012 Express

Below is a Step by step guide on how to migrate files from SQL Compact Edition to SQL Server 2012. Very useful if you have configured SQL Express 2012.

For anyone need help configuring SQL Express 2012 for SambaPOS follow the simple steps on below link:

[Creating the migration file]

  1. Locate the file SambaPOS4.sdf file in SambaPOS folder in My Documents. Copy it and paste it on your C:\ drive. The file should be located here “C:\SambaPOS4.sdf” (This is for easier migration)

  2. Copy the ExportSqlCE40.exe file to the same destination of your SambaPOS4.sdf file. (C:\ExportSqlCE40.exe).( Attached is zipped ExportSqlCE40.exe file, you need to unzip after downloading.) (43.8 KB)

  1. Open a command prompt window (Windows key + R and type in CMD - open command prompt as Administartor) and make sure you navigate to the folder where both files you copied in step 2 and 4 are pasted. (Type in “cd c:” without quotations)

  2. By this step you should see the command prompt with C:\

  3. Next type this ExportSqlCE40.exe “Data Source=c:\SambaPOS4.sdf” migrate.sql

  1. Program will create the migrate.sql file. after completion head to your C:\ drive and you should see a file named migrate.sql

[Restoring the database to SQL Server]

  1. Open up SQL Server Management Studio Express and connect to your server.

  1. Open up Databases and create a new database called i.e “SambaData2”

  1. Close SQL Server Management Studio and open the file “migrate.sql” created earlier and connect to the server. (double click on migrate.sql to execute)

double click on migrate.sql

connecting to the server.


  1. Click on Execute and your database will be restored from SQL compact edition to SQL server 2012.


I have done all there but still i cant find any data in my POS,
Please help

I guess i have the same problem like you did you manage to fix it.

I have written a script to migrate the sdf file to SQL.

@Marza, you can also check following forum for same issue.

Only my products and menus are imported, no prices, no printer settings/templates etc

@morshed1, Message Server has nothing to do with SQL Server. This is a common misconception, and they need to be addresses separately.

@Marza, have you tried my script yet ?

1 Like

@JohnS, I’ve tried it, everything worked fine thanks, the only thing my prices and printer templates are missing

PM me you SDF file. Every SDF I have converted has all the data.

I am not much experienced in SambaPOS just two weeks i being to this,

  1. Check ur database status is connected.
  2. Same like above reply, messaging server started or not.
  3. Check ur path is correct and make sure u have given the name of database (sambadata2)

1 Like


Message Server has nothing to do with SQL Express Server.

When you see Message Server Not Connected it means "Message Server" Not Connected

People are getting confused thinking it means Message : Server Not Connected

Thanks John, I got the point.

i tried all of the steps for a SambaPOS3.sdf database, but it didn’t work for me.
can anyone help?

how do you do this in sambapos v3?
i can’t seem to find the property editor like in you picture.

Sorry for late reply, it is not v3 it is sambapos4!
just the database name is sambadata2