DB delete old records error Incorrect syntax near '-'.
Bartender version: 2021 R3
SQL - 2019
On the database schedule maintenance, backup and delete older records. We get this error.
Stored Procedure: [dbo].[SpBackupDeleteOlderRecords] Failed; Inner Message: Incorrect syntax near '-'.
Processed 73496 pages for database 'Bartender', file 'Bartender' on file 1.
Processed 1 pages for database 'Bartender', file 'Bartender_log' on file 1.
BACKUP DATABASE successfully processed 73497 pages in 3.039 seconds (188.940 MB/sec).
How to solve this error?
-
Hi David!
Thank you for sharing your issue in the Community Forums!
The error message we are receiving points out to this being a syntax error. Has this ever worked? And if so, has anyone updated the script you are using?
Please, make sure the script you are using lacks any syntax errors. If the script used to work and you have a backup or snapshot of the workstation you can revert to, we could also try reverting to this point and retrieving the old script so we can compare it to the newer one.
You could also try the following workaround:- Open SQL Server Management Studio.
- Download the SpDefragmentIndexes.sql SQL Script provided by our Development Team (Pastebin link to the file here).
- Once the file is downloaded, double click the .sql file, so it opens within SQL Server Management Studio.
- You can execute the script by pressing F5.
Hopefully, these suggestions will be of use.
0 -
David Mason
★ BarTender Hero ★
Hi Xabier,
I do not know what you mean be script, I was running the standard Bartender Administration Console - Maintenance task to delete older records.
I updated the SpDefragmentIndexes stored procedure on the Bartender DB. Looks to a minor update with addition of brackets around the index names.
Will monitor over the next days to see if it is resolved.
0 -
By script, I meant the set of orders a maintenance task is given. I presume by your answer these orders were not modified then.
The script we've implemented now should reorganize and rebuild the index if the fragmentation level is higher than the given threshold, which could be the reason we were experiencing this issue.
Keep us posted! Hopefully, the error will be gone for good.0
Please sign in to leave a comment.
Comments
3 comments