Skip to main content

Notifications

Announcements

No record found.

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

  • 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)='-'

  • RE: SQL Help : Cleaning up Item Lookup Codes

    No problem

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

    Thank you VERY much!!!

  • Verified answer
    RE: SQL Help : Cleaning up Item Lookup Codes

    UPDATE ITEM SET ITEMLOOKUPCODE=LEFT(ITEMLOOKUPCODE,LEN(ITEMLOOKUPCODE)-1) 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans