Sql delete selected rows and restructure table

hi everybody,

if we delete some selected rows the table looks like this

1 random text
2 random text
4 random text
6 random text

how can i restructure the table so it looks like this

1 random text
2 random text
3 random text
4 random text

thank you guys

That is not a Sambapos question. That’s a SQL server question. Maybe google it? What are you deleting and why? Maybe we can suggest better alternative.

Typically you should never delete rows. You most definitely don’t want to mess with row Id that could cause complete corruption of the database.

If you share what your trying to do we might be able to give better guidance.

I get the feeling this will pan out to be a ‘removal of sales’ type question…
Excuse me if not.

thanks for the quick answers. it´s a removal of test / training sales type question :sweat_smile: :wink:

already live/have old data? database tools task of clear transactions not suitable?

cannot restructure ids it says identiy column cannot change … :wink:

It would not be good idea anyway as kendash said?

If your wanting to ‘cancel’ paid tickets from testing transactions you could use the reopen closed ticket and cancel payment actions from the more ticket actions module.
Or just refund them…
At least then your cash figures will be accurate.

Do you have any data you do not want to remove?

BTW in the future you should consider turning on Training Mode when running test transactions so it wont affect your live database. Here is how to turn on training mode in version 5.

You can’t do this it will break your database.

yes some transaction i do not want to remove :smile:

thanks for the training mode

Your best option is to leave the test transactions there and in future use training mode or a separate database for testing. To correct accounting you should make a correction account and move funds to there and start over fresh with next work period.

Training mode basically creates a copy of your database and connects to it instead of your live database… when you exit training mode it deletes the copy database and connects back to your live one.

thank you very much for the explanation. have a nice weekend.

Just quick note, DO NOT FORGET that training mode is duplicate database and any changes you make in database recorded settings (pretty much all exc ‘Local Settings’) will be cleared along with any sales data etc.

@Jesse this is still correct for V5 right?

I think this explains it quite well.

That means any Local Settings you do would still be there, Program Settings would not.

1 Like

I just wanted to illiterate that the program settings will also be lost encase @tvboe didnt realise and configured lots of settings while in training mode :smile:

1 Like

I understand but this is wrong. Local Settings will still be there, Program Settings would not. Local Settings are not stored in Database hence the term Local, Program Settings are.

:smile: that’s what i said - excluding Local Settings

1 Like

LOL so thats what exc is… Terminology conflict sorry.

:stuck_out_tongue: come on kendash, you really never used exc? link inc TAX and exc TAX?

No I haven’t I usually typed it out :stuck_out_tongue: Sorry maybe I am old school but I typically try not to abbreviate when discussing things except for very well known acronyms. Maybe its the way I was taught.

I use some things like LOL and a few old school stuff but for most part I dont use it much.