Skip to main content

Notifications

Microsoft Dynamics RMS (Archived)

SQL Command Help

Posted on by Microsoft Employee

Need a SQL Command that i can make itemnotdiscountable by Department

 This is what i have

UPDATE dbo.Item SET ItemNotDiscountable = 1 Where dbo.Department SNACK

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SQL Command Help

    J.arun is correct.   Just one thing.  If you want all Barbies from all departments then run this set of queries.  

    Select ItemLookupCode, [Description],* from Item

    Item INNER JOIN Department ON Item.DepartmentID = Department.ID

    WHERE    Item.Description like '%barbie%'

    If you see all looks good, Please run below SQL

    UPDATE  Item

    SET              QuantityDiscountID = 0

    FROM         Item 

    WHERE    Item.Description like '%barbie%

    Not sure what you mean by "Can this be used to lock  items".  Security levels can be used to control editing of items. Steps for Security setup can be found in the contextual help by searching for Security Setup.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SQL Command Help

    Please run below SQL first and make sure the items going to be updated are correct.

    Select ItemLookupCode, [Description],* from Item

    Item INNER JOIN Department ON Item.DepartmentID = Department.ID

    WHERE     (Department.Name = N'SNACK') and Item.Description like '%barbie%'

    If you see all looks good, Please run below SQL

    UPDATE  Item

    SET              QuantityDiscountID = 0

    FROM         Item INNER JOIN Department ON Item.DepartmentID = Department.ID

    WHERE     (Department.Name = N'SNACK') and Item.Description like '%barbie%

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SQL Command Help

    Can this be used to lock  items that contains a particular description like if i wanted to locked all toys that contain barbie the description

  • Saudi Market Profile Picture
    Saudi Market 875 on at
    RE: SQL Command Help

    if you mean stop discount you can use the following script

    -----------------------

    UPDATE    Item

    SET              QuantityDiscountID = 0

    FROM         Item INNER JOIN Department ON Item.DepartmentID = Department.ID

    WHERE     (Department.Name = N'SNACK')

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans