Hi,
Anyone have a sql query to make items inactive if they have 0 quantity on-hand and have not been sold in 13 months?
Thanks,
Doug
Hi,
Anyone have a sql query to make items inactive if they have 0 quantity on-hand and have not been sold in 13 months?
Thanks,
Doug
UPDATE Item SET Inactive = 1 WHERE LastSold < getdate()-395 AND Inactive = 0 AND Quantity = 0
The "getdate()-395" is 395 days prior to the current date when you run the query which is approximately 13 months (365 days + 30 days)
Change this to however many number of days prior to today you want.
If you'd like to review inactive selections before committing any changes, try this tool.
DRS Tools installer:
Select Maintenance, Mark Inactive, press F5 to view current candidates or select by filter. The default is items with no activity in 12 months and zero on hand. You can also view inactive items and make them active.
Have something to add? Share your thoughts — no account required.
Ask the community — no account required