How do I delete or clear a SQL database?

I’ve loaded too many Pre-build Databases while trying out V4, so I have buttons and actions and rules coming our of my ears. I would like to start with my “Going Live” server.

I would like to do a clean install if I can. Would I be able to clear all data in SQL? Or do I have to reload a new Samba POS database?

Thank You

2 Likes

You can delete the custom settings if you know what they are. Or just delete the database and let it remake it. No need to reinstall. Use MSSMS to delete the db. When you delete it and restart samba it will make a fresh new db

Thank You Kendash, I was looking for some direction on how to do this, I have the data base open in MSSMS.

Where now?

The procedures to backup, restore and delete are very easy in MSSMS.

I created a pdf (see attached) so you can have an idea of this…

Also I have uploaded a .bat file that makes the database backup whithout using MSSMS GUI.
DBBackup.pdf (6.5 KB)
Database Tasks.pdf (529.2 KB)

4 Likes

Thank you Abekeris! It is easier than I thought

@abekeris @Jesse I ask you for advice…

My database doesn’t want to connect. I deleted the database as you described in the PDF, it worked well for a whole day without any problems and today when I wanted to continue it gave me this error… SAMBApos also said it could not connect to the SQL database.

The only thing that changed is that now i’m using the stock database supplied with clean Samba install.

Any ideas?

This would be more than likely your SQL Server is not installed anymore or the service is not running.

Or it could be exactly what it says your instance name is wrong or you changed the instance name. But since you say it was working just fine and you didnt change anything… its more than likely the service is not running anymore.

Check your services to see if your sql server is running. If your connecting from a remote computer make sure you have the option to accept remote connections enabled on the actual server.

BTW Samba does not install a clean database when you reinstall. If you have it pointed at a SQL Express db via connection string and you delete that database or there is not a database Samba will create one with sample data.

Does not matter if you reinstall samba or not… simply deleting the database will cause samba to make a new one if you leave connection string the same.

I mean if you have a database and you do not delete it… but you reinstall samba it will just connect to that database again it will not create a fresh new one. However, It will update it to a newer version if the version of samba you reinstall is newer than the version the db was on.

Did you make any changes to Windows? Anything that would have caused the SQL Server to shutdown or not start?

1 Like

Thank you for your input @Jesse I restarted a couple of times and it reconnected, I have no idea how or why but it worked!

Thank you!

If you restarted your computer it probably restarted the Service. So it was more than likely the service was stopped.

I have seen this on very rare occasion. The reason you couldn’t connect is because the SQL Server service was probably not running, and when you restart your PC, that would have the effect of starting the service.

You can also check the state of the service manually, and start it if it isn’t already running through:

Control Panel > Administrative Tools > Services

Or:

Start > Run > services.msc

Do you always use windows authentication? Try logging in with the database user instead (i.e.sa user). If logging from another computer, check that IP protocol is enabled in the “SQL Server Configuration Manager” (service must be restarted)