How To Bulk Update Segment Descriptions From A CSV

Microsoft Dynamics GPOn the Microsoft Dynamics GP Community site a question from Lisa Sorenson in October last year asking if it was possible to use the Table Import (Microsoft Dynamics GP menu » Tools » Integrate » Table Import) feature in Microsoft Dynamics GP to update some Segment descriptions has risen to the top with Steve Cummings linking to a post where the suggestion is to use a CSV file and Word template to generate a mailmerge.

This solution will work, but can be accomplished in much less time and effort by using the SQL command BULK INSERT to load the CSV (formatted as Segment ID, Segment Number and Description), in the below SQL change the highlighted path to the location of your CSV file, into a temporary table and update Account Segment Master (GL40200) from the temp table (which is removed at the end of the script);

CREATE TABLE #SegmentDescriptions


   Segments.SGMTNUMB = NewSegments.SGMTNUMB
   ,Segments.SGMNTID = NewSegments.SGMNTID
   ,Segments.DSCRIPTN = Left(NewSegments.DSCRIPTN, 31)
   GL40200 AS Segments
   #SegmentDescriptions AS NewSegments ON NewSegments.SGMTNUMB = Segments.SGMTNUMB
      AND NewSegments.SGMNTID = Segments.SGMNTID

DROP TABLE #SegmentDescriptions

The above script is supplied as is with no warranty; if you use the script please ensure you have a backup of your company database before starting.

Can ISC Software help?

ISC Software Solutions are UK and Ireland based experts on Microsoft Dynamics GP. If you would like to speak to someone about support, consultancy, upgrades, implementation, development, GP Elementz add-ons or portals, or anything else Dynamics GP related, you can use the form below.

Your Name

Your Email


Your Enquiry

What should we write about next?

Your Name

Your Email

Suggested Topic

Suggestion Details

5 thoughts on “How To Bulk Update Segment Descriptions From A CSV

  1. Pingback: Comment
  2. Comment says:

    Thanks so much for the script. It seems pretty straight forward but when I attempted to run it at a client site, I received the following message. It is during the process of running the update statement and setting the valies.

    Msg 8152, Level 16, State 14, Line 1
    String or binary data would be truncated.
    The statement has been terminated.

    Any idea what could be causing this and how to correct it? Thanks again for the information!

  3. Comment says:

    Hi Lisa,

    I’ve just done some testing and it appears the error is caused by one (or more) of the descriptions being longer than the 31 characters allowed by the Segment Description Master table.

    I have updated the script above to only use the first 31 characters of the description from the CSV to prevent the error.


  4. Pingback: Comment
  5. Pingback: Comment

Leave a Reply

Your email address will not be published. Required fields are marked *