8

Recently I realized by default, scripting the database does not including indexes, and I have to change the option every time.

Could anyone please explain the reason? Is there any insight about this default behavior, or just because Microsoft likes to do so?

  • You'd have to ask the developers of SSMS, more likely the original developers as most defaults won't be changed unless there is a very specific reason to do so. – Sean Gallardy - Retired User Jun 21 '16 at 2:32
  • What do you mean by "every time"? Every time you generate scripts, or every time you install Management Studio, or something else? As for why it's the default, you'd have to ask Microsoft, not your peers. I can assure you they choose defaults for reasons other than "they like it," but those reasons are not commonly documented. File a suggestion on the SQL Server feedback forum and, who knows, maybe they'll tell you why it's that way and/or why they won't change it. – Aaron Bertrand Jun 21 '16 at 2:33
  • @AaronBertrand Everytime I do a new Scripting operation (right click database -> Task -> Generate Scripts). The options are not remembered, you have to choose it every time. – Luke Vo Jun 21 '16 at 2:35
  • 1
    @SeanGallardy Yes I am just asking the reason to understand why it is False by default, I just like to know if anyone knows :) – Luke Vo Jun 21 '16 at 2:36
  • 2
    Change the option in tools / options / Object Explorer / scripting. – Aaron Bertrand Jun 21 '16 at 2:36
9

You don't have to change the option every time. If you change the selection in Tools > Options > Object Explorer > Scripting, it should persist.

As for why not scripting indexes is the default, I have no idea. Not a great question for your peers; if you really want the background, hit up someone on the SSMS team and buy them a beer - maybe they'll be able to share it. You could also consider submitting a suggestion on the SQL Server feedback forum (if one doesn't already exist), and they will possibly tell you why it's the default and/or why they won't be changing it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.