Skip to main content

Notifications

Microsoft Dynamics RMS (Archived)

Sql Query Help

Posted on by Microsoft Employee

I need to add 4 zeros to the start of all exsisting item lookup codes. Would anyone know a sql query to achieve this?

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sql Query Help

    Thanks worked perfect

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sql Query Help

    My SQL Server 2005 is a little rusty, but I think he plus sign (+) acts as a concatenate operator in SS2005;

    First try this

    SELECT ITEMLOOKUPCODE, '0000'+ITEMLOOKUPCODE AS NEW_ILC

    FROM ITEM

    If it looks good, you can do an update  -  backup your database first

    UPDATE ITEM

    SET ITEMLOOKUPCODE =  '0000'+ITEMLOOKUPCODE

    Would also suggest you backup your db, restore as a "testing" database, and run the update statement on your test db first, in case you have ILCs that are less than four characters from the limit of the ILC field.

    Another option is to keep your ILC but insert the ILC with the four zeroes as an ALIAS

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,902 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,297 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans