• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Edit
Show / Hide Table of Contents

Working with Truncate

•
Version: 9.2 R04
Some tooltip text!
• 1 minute to read
 • 1 minute to read

This method is used to remove all records in a table. All records afterward are irrecoverable. It is extremely fast, dependent on table size.

Warning

This will truncate the whole table, but won't delete the table itself.

Truncate Examples

  • Agent RESTful API
  • Core API
using SuperOffice.WebApi;
using SuperOffice.WebApi.Data;
using SuperOffice.WebApi.Agents;


// set up the DatabaseTable agent

WebApiOptions options = //Get WebApiOptions with SystemUser Authorization
DatabaseTableAgent dta = new DatabaseTableAgent(options);

// table name

string tableName = "y_rental";

MassOperationResult massResult = await dta.TruncateAsync(tableName);

if(massResult.Success)
{
    Console.WriteLine($"Removed {massResult.Deletes} records from {tableName}.");
}
using SuperOffice.Data.Dialect;

var mo = MassOperations.GetCurrent();

// table name

string tableName = "y_rental";

MassResult massResult = mo.Truncate(tableName);

if(massResult.Success)
{
    Console.WriteLine($"Removed {massResult.Deletes} records from {tableName}.");
}
In This Article
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top