Error report, please help me read what is the problem

I have deleted the table dbo.“Report Temp”
I have run the Metrik script, it says it wasn’t there on database.

Your hd is full or your sql server is full. It really looks like your hard drive is full.

Not HD, how to I minimize the size safely Jesse?

ok tried shrink DB via SQL, that didn’t work

here are my screen shots after I have shrunk DB and deleted ReportTemp

Please check your db settings to ensure auto growth is enabled.

Also, you have 4-times the amount of tasks as you do orders. What are you using tasks for?

for tasks I have implemented most of the tutorials on this V5. Some I use, some I don’t, but to know what is important and what to deleted is the question… I have a normal restaurant setup with many screens as we have many departments and I use the Task Printer Screen system and 2 main departments and 5 small kitchens (bar,coffee, milkshakes,pizza,main meal,etc)

I could not save todays work period because of that same error I shared in 1st port, had to Backup yesterdays work period unfortunately so cash up and stock take will be an nightmare.

So what I have done so far in case anyone else has same problem:

  • shrink DB via SMMS (task)
  • run Metrik script from this forum to eliminate old ReportTemp DB table via SMMS
  • made sure Autoshrink was enabled
  • made sure Autogrowth was enabled and increased it to 100mb (MSSQL Database Autogrowth Configuration)
  • Increased DB allocated size (same link)

You could also upgrade to full sql. Or even try the developer version although you are not supposed to use that in production.

Jesse has a point - you may be hitting some limitation of the express version.

I’d want to investigate the the huge tasks table.

Hey @Jesse, once a task is marked complete, can that task be restarted/enabled in the future? I know nothing of tasks but I’m wondering if OP could just delete all the completed tasks from the table without impacting current operations.

1 Like

What can I send you a screen-shot of to see the Tasks active?

From what I gather from your posts, you’re using tasks to route orders to various kitchen displays, no?

You can delete any tasks. It shouldn’t impact it. It will only be a bandaide he should consider upgrading. Or archiving data if upgrading isn’t an option.

1 Like

yes, mostly task print screen.

Does the data for ELG Event Log need to persist?

I doubt it must be important…

This i believe is the origin:

In the above scenario, we solved that by disabling the default cancel order rule and instead implemented automation that voids the orders but the ticket persists. Then ticket logging works without issue.

Backup your database before executing any changes.

I am assuming that the tasks have been marked as completed.

If you want to keep your the logging data, execute this script in SSMS:

BEGIN TRANSACTION;
BEGIN TRY
    DECLARE @ErrorMessage NVARCHAR(MAX);
    DECLARE @ErrorSeverity INT;
    DECLARE @ErrorState INT;

    DECLARE @TaskTypeId INT;

    SELECT @TaskTypeId = Id
    FROM dbo.TaskTypes
    WHERE Name = 'ELG Event Log';

    DELETE FROM dbo.Tasks
    WHERE TaskTypeId <> @TaskTypeId
          AND Completed = 1;

    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
    IF @@TRANCOUNT > 0
    BEGIN
        ROLLBACK TRANSACTION;

        SET @ErrorMessage = ERROR_MESSAGE();
        SET @ErrorSeverity = ERROR_SEVERITY();
        SET @ErrorState = ERROR_STATE();
        RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
    END;
END CATCH;

if you don’t care about the log data, use this script:

BEGIN TRANSACTION;
BEGIN TRY
    DECLARE @ErrorMessage NVARCHAR(MAX);
    DECLARE @ErrorSeverity INT;
    DECLARE @ErrorState INT;

    DELETE FROM dbo.Tasks
    WHERE Completed = 1;

    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
    IF @@TRANCOUNT > 0
    BEGIN
        ROLLBACK TRANSACTION;

        SET @ErrorMessage = ERROR_MESSAGE();
        SET @ErrorSeverity = ERROR_SEVERITY();
        SET @ErrorState = ERROR_STATE();
        RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
    END;
END CATCH;
3 Likes

The task DB is much smaller now…

There’s still quite a bit of data in there. My guess is some tasks aren’t being marked complete.

If you want to completely clear the table and don’t care about anything stored in that table, this will clear the rest out for you.

Also, be sure to shrink the database - use SSMS and select the following:

image

BEGIN TRANSACTION;
BEGIN TRY
    DECLARE @ErrorMessage NVARCHAR(MAX);
    DECLARE @ErrorSeverity INT;
    DECLARE @ErrorState INT;

    TRUNCATE TABLE dbo.Tasks;

    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
    IF @@TRANCOUNT > 0
    BEGIN
        ROLLBACK TRANSACTION;

        SET @ErrorMessage = ERROR_MESSAGE();
        SET @ErrorSeverity = ERROR_SEVERITY();
        SET @ErrorState = ERROR_STATE();
        RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
    END;
END CATCH;
2 Likes

Msg 50000, Level 16, State 1, Line 19
Cannot truncate table ‘dbo.Tasks’ because it is being referenced by a FOREIGN KEY constraint.

This is response from SMS after running the query

Ahh, sorry about that. This should work on a table with FK references:

BEGIN TRANSACTION;
BEGIN TRY
    DECLARE @ErrorMessage NVARCHAR(MAX);
    DECLARE @ErrorSeverity INT;
    DECLARE @ErrorState INT;

    DELETE FROM dbo.Tasks;

    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
    IF @@TRANCOUNT > 0
    BEGIN
        ROLLBACK TRANSACTION;

        SET @ErrorMessage = ERROR_MESSAGE();
        SET @ErrorSeverity = ERROR_SEVERITY();
        SET @ErrorState = ERROR_STATE();
        RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
    END;
END CATCH;