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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics RMS (Archived)

Sql Query Help

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    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

  • Community Member Profile Picture
    on at

    Thanks worked perfect

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics RMS (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans