Inserting and updating a SQL Statement

Prev Next

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:

    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:

    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.

Important

Don’t omit the WHEREclause, otherwise all records will be updated!

Result

You have inserted a new or updated an existing SQL statement.