Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics RMS (Archived)

A SQL command for making items inactive with the following conditions: Onhand = zero and last sold before 1/1/2009

Posted on by Microsoft Employee

I am looking for a SQL command for making items inactive with the following conditions: Onhand = zero and last sold before 1/1/2009. I need to change the items on both Store Operations and HQ. Thank-you for any help. Adam

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: A SQL command for making items inactive with the following conditions: Onhand = zero and last sold before 1/1/2009

    REally and Truly its just knowing sql..  Look up basic sql commands and you should be able to do pretty much anything.  Also there are tools out there that let u connect to the mssql server  and see all the tables and run queries.  I havent had much/any time to get into this , but i think enterprise manager is one such tool.   Good Luck. any questions u can always post here

  • onontri Profile Picture
    onontri 100 on at
    Re: A SQL command for making items inactive with the following conditions: Onhand = zero and last sold before 1/1/2009

    This is fantastic information - Jason, is there any tutorial out there where I can learn how to write other script? I'd like to run similar queries - but more narrow in focus - by vendor; description;...

    where can I learn to do this?

    thanks you - alfred

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: A SQL command for making items inactive with the following conditions: Onhand = zero and last sold before 1/1/2009

    you need to login to administrator and there is a query tool there

  • onontri Profile Picture
    onontri 100 on at
    Re: A SQL command for making items inactive with the following conditions: Onhand = zero and last sold before 1/1/2009

    Ryan - this may be a stupid question - but where do I run this script?

  • Verified answer
    Ryan Sakry Profile Picture
    Ryan Sakry 3,425 on at
    Re: A SQL command for making items inactive with the following conditions: Onhand = zero and last sold before 1/1/2009

    Adam,

    This script will do what you want, though it will not get rid of any items that have never sold as the last updated will be NULL.

    UPDATE Item

    SET Inactive = 1

    WHERE Quantity = 0 and LastSold < '2009-01-01'

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans