V4 Clear Database Entries

How can I clear the V4 database of all entries after setting it up?
Or is there a training mode as in V2??

How about adding a standard feature that will allow the administrator to reset and/or restore the database. For example when the administrator clicks on the reset button sambapos automatically creates a backup which can be used to restore the database entries in case of an error or somebody who is up to mischief. This way the data should be safe :slight_smile:



Thank you kindly,
P.S. I had no idea that would work for V4 as it states V3

Ok just in case anybody else has trouble getting this script going here is what you do:

  1. Downloaded Emre’s script from https://gist.github.com/emreeren/5806902
  2. Extract the files to e.g. MyDocuments/SambaPos4 folder
  3. Download and intall something like: SQL Server Compact Toolbox for 4.0
  4. Start “SQL Server Compact Toolbox for 4.0” and right click on: “SQL Server Compact Data Connections” then click “Add SQL Server…”
  5. Hit “Browse” and point it to either your “SambaPOS3” or “SambaPOS4” Folder (Do a “Test Connection” if you want) then “Close”
  6. Right Click on your “SambaPOS3” or “SambaPOS4” icon and click “Open SQL Editor”
  7. Hit the other “Open” icon which just appeared on the right side and point it to Emre’s script
    • Final Step - Click on “Execute”

Will this script work for “Local Database” (Samba.sdf,) or for Microsoft SQL Database Installation?


Bye Maurizio

It works for both but you’ll run this script with SQL Management Studio for MSSQL.

It work’s fine in SQL Management Studio for MSSQL too. Good Script.
Thank’s Emre

I ran this with compact SQL toolbox on my SambaPOS 4 install with CE.

It worked for removing everything except it also destroyed my “Manage” screen. My “Manage” screen is totally blank and incorrectly formatted. Is there a fix for this?

Here is a link of my Manager screen after running the above script: https://www.dropbox.com/s/b7wlggeqodi939v/manage.png

1 Like

@luisvarca this is not related with clear database script. In some cases that happens for some users but I still couldn’t find the reason. Just restart SambaPOS and that will work fine. I’ll try to find a solution on next updates.

This can be done from the command line:

  1. Create a file with the SQL sentences and named it ClearDatabase.sql

  1. Execute the following command from cmd:

      sqlcmd -S localhost -i ClearDatabase.sql -o output.txt

Make sure that you are running “sqlcmd” in the same directory where the “ClearDatabase.sql” file is saved, if not, use the full path.

If you don’t want to save the output or just want to see it on screen, omit “-o output.txt” from the command.

im having a problem with clearing the database entries on windows 8.
can someone help me

Do you have SQL management Installed on your PC ?

yes . how did you get that screen in sql 2014. for local


1.OPEN sql management studo (click windows button on windows 8, and you will see the software in there.)
2.When it will open, it will ask you for some details. Those details are done already by you or not. Please check the link above. you will find all the answers there. Then reply with what you need.