--- title: "Inserting and updating a SQL Statement" slug: "inserting-and-updating-a-sql-statement" tags: ["task", "dox42 Server V5.0.2.6"] updated: 2025-04-30T06:51:17Z published: 2025-06-26T06:42:31Z canonical: "help.dox42.com/inserting-and-updating-a-sql-statement" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.dox42.com/llms.txt > Use this file to discover all available pages before exploring further. # Inserting and updating a SQL Statement Use the INSERT INTO or UPDATE statement to insert a new or update an existing SQL statement. ## Steps for INSERT INTO statement 1. Use the following INSERT INTO syntax to insert a new SQL statement: ```sql INSERT INTO [dbo].[GenDoc]           ([PagesTotal]           ,[PagesToBookmark]           ,[GeneratedDocument]           ,[Comment])     VALUES           (<%Document.PageCount%>, <%Document.PageOfBookmark(BM1)%>, <%Document%>,           'Invoice for <%Customer.Name%>') ``` ## Steps for UPDATE statement 1. Use the following `UPDATE` syntax to update an existing SQL statement: ```sql UPDATE [dbo].[GenDoc]   SET [PagesTotal] = <%Document.PageCount%>      ,[PagesToBookmark] = <%Document.PageOfBookmark(BM1)%>      ,[GeneratedDocument] = <%Document%>      ,[Comment] = 'Updated invoice for <%Customer.Name%>' WHERE ID= <%ID%> ``` The `WHERE` clause specifies which record(s) should be updated. > [!WARNING] > Important > > Don’t omit the `WHERE`clause, otherwise all records will be updated! ## Result You have inserted a new or updated an existing SQL statement.