Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics RMS (Archived)

SQL to delete all quotes

Posted on by 370

i would like to delete all my quotes.

they have never been deleted and have about 2-3 hundred

 

*This post is locked for comments

  • hozay Profile Picture
    hozay 370 on at
    Re: SQL to delete all quotes

    okidoki [ i ] will :)

  • Gerald Rothaus Profile Picture
    Gerald Rothaus 2,930 on at
    Re: SQL to delete all quotes

    Oh, one more note on sql. Some sql objects may have names like table or column names we might use, like 'time' or 'date'. So it is a good habit to always use brackets ( [ ] ) around objects you are referring to,

    like '[Order]' or '[Type]'.

    A small mistake and the consequences could be dire. Ooooooohhhhhh.....

    Seriously, use the brackets.

    -Jerry

    JR Data

  • hozay Profile Picture
    hozay 370 on at
    Re: SQL to delete all quotes

    thanks for the help ill try it this week

  • Gerald Rothaus Profile Picture
    Gerald Rothaus 2,930 on at
    Re: SQL to delete all quotes

    Shouldn't it be

    DELETE FROM [Order] WHERE Type=3

    I am assuming that Andy is right about the type being 3 for a quote.

    Adding 'AND Closed = 0' would mean only open quotes.

    If you are not SO savvy, you must go to the SO Administrator, connect to the database

    (File/Connect), put this stuff in the query window, and hit the green arrow.

    -Jerry

  • Andy Miller Profile Picture
    Andy Miller 870 on at
    Re: SQL to delete all quotes

    This script that I am posting has not been Tested thoroughly at all. Use at your own risk!

    You might want to backup your database just incase it doesnt give you the results you are looking for.

    I quickly put this together, and it should be a good starting point for you, but again, this has not been tested at all.

    DELETE [Order]

    WHERE Closed = 0 AND Type = 3

    DELETE OrderEntry

    WHERE OrderID NOT IN (SELECT ID FROM [Order])

    DELETE OrderHistory

    WHERE OrderID NOT IN (SELECT ID FROM [Order])

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,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans