web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics RMS (Archived)

SQL Help : Cleaning up Item Lookup Codes

(0) ShareShare
ReportReport
Posted on by 908

Hi, All!  I'm only halfway through SQL For Dummies, and am hoping someone can help me with a SQL query to clean up a data entry issue.

Somewhere along the line someone created hundreds of products with an extra hyphen at the end of the item lookup code, which has been a pain when manually typing in lookup codes.   

Does anyone out there have the SQL skills to write a query that would look at the Item Lookup Code, check to see if it ends in a hyphen, and it it does, remove that last hyphen without removing any other hyphen in the lookup code?

Any help is greatly appreciated.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: SQL Help : Cleaning up Item Lookup Codes

    UPDATE ITEM SET ITEMLOOKUPCODE=LEFT(ITEMLOOKUPCODE,LEN(ITEMLOOKUPCODE)-1) WHERE RIGHT(ITEMLOOKUPCODE,1)='-'

  • Taier P Profile Picture
    908 on at
    RE: SQL Help : Cleaning up Item Lookup Codes

    Thank you VERY much!!!

  • Community Member Profile Picture
    on at
    RE: SQL Help : Cleaning up Item Lookup Codes

    No problem

  • Community Member Profile Picture
    on at
    RE: SQL Help : Cleaning up Item Lookup Codes

    But if u r in HQ environment, u will need to make sure to replicate the changes to stores, so u should amend the above statement to change the LastUpdated field and therefore u can create an "Update Inventory" worksheet using the "recently changed" option

    UPDATE ITEM

    SET ITEMLOOKUPCODE=LEFT(ITEMLOOKUPCODE,LEN(ITEMLOOKUPCODE)-1)

    ,LastUpdated=getdate()

    WHERE RIGHT(ITEMLOOKUPCODE,1)='-'

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics RMS (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans