sql server: get all the databases in which a login is being used The 2019 Stack Overflow...

If a Druid sees an animal’s corpse, can they wild shape into that animal?

How to deal with fear of taking dependencies

What is the closest word meaning "respect for time / mindful"

Why do we hear so much about the Trump administration deciding to impose and then remove tariffs?

How come people say “Would of”?

"as much details as you can remember"

What does ひと匙 mean in this manga and has it been used colloquially?

How to support a colleague who finds meetings extremely tiring?

How to type this arrow in math mode?

Why do UK politicians seemingly ignore opinion polls on Brexit?

Are there any other methods to apply to solving simultaneous equations?

Why didn't the Event Horizon Telescope team mention Sagittarius A*?

Return to UK after being refused entry years previously

Is flight data recorder erased after every flight?

Why can Shazam fly?

Deal with toxic manager when you can't quit

Should I use my personal e-mail address, or my workplace one, when registering to external websites for work purposes?

Why is the maximum length of OpenWrt’s root password 8 characters?

Am I thawing this London Broil safely?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

How to obtain Confidence Intervals for a LASSO regression?

Multiply Two Integer Polynomials

Is there a symbol for a right arrow with a square in the middle?

Right tool to dig six foot holes?



sql server: get all the databases in which a login is being used



The 2019 Stack Overflow Developer Survey Results Are In





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I'm creating a few migration scripts to generate a sql server database from scratch.



In my '0005-create_login.up.sql' script I have something like:



CREATE LOGIN [mylogin] WITH PASSWORD=N'xxx=', 
GO


And in my '0005-create_login.down.sql'



DROP LOGIN [appws]
GO


Now I'd like to drop the login only if it is not being used in another database. I had a look at sp_helplogins code with:



sp_helptext 'sp_helplogins'


but it's really complex. I wonder if there's and easier way to get a login with the databases it is being used.









share





























    0















    I'm creating a few migration scripts to generate a sql server database from scratch.



    In my '0005-create_login.up.sql' script I have something like:



    CREATE LOGIN [mylogin] WITH PASSWORD=N'xxx=', 
    GO


    And in my '0005-create_login.down.sql'



    DROP LOGIN [appws]
    GO


    Now I'd like to drop the login only if it is not being used in another database. I had a look at sp_helplogins code with:



    sp_helptext 'sp_helplogins'


    but it's really complex. I wonder if there's and easier way to get a login with the databases it is being used.









    share

























      0












      0








      0








      I'm creating a few migration scripts to generate a sql server database from scratch.



      In my '0005-create_login.up.sql' script I have something like:



      CREATE LOGIN [mylogin] WITH PASSWORD=N'xxx=', 
      GO


      And in my '0005-create_login.down.sql'



      DROP LOGIN [appws]
      GO


      Now I'd like to drop the login only if it is not being used in another database. I had a look at sp_helplogins code with:



      sp_helptext 'sp_helplogins'


      but it's really complex. I wonder if there's and easier way to get a login with the databases it is being used.









      share














      I'm creating a few migration scripts to generate a sql server database from scratch.



      In my '0005-create_login.up.sql' script I have something like:



      CREATE LOGIN [mylogin] WITH PASSWORD=N'xxx=', 
      GO


      And in my '0005-create_login.down.sql'



      DROP LOGIN [appws]
      GO


      Now I'd like to drop the login only if it is not being used in another database. I had a look at sp_helplogins code with:



      sp_helptext 'sp_helplogins'


      but it's really complex. I wonder if there's and easier way to get a login with the databases it is being used.







      sql-server migration logins





      share












      share










      share



      share










      asked 3 mins ago









      opensasopensas

      13914




      13914






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f234503%2fsql-server-get-all-the-databases-in-which-a-login-is-being-used%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f234503%2fsql-server-get-all-the-databases-in-which-a-login-is-being-used%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          ORA-01691 (unable to extend lob segment) even though my tablespace has AUTOEXTEND onORA-01692: unable to...

          Always On Availability groups resolving state after failover - Remote harden of transaction...

          Circunscripción electoral de Guipúzcoa Referencias Menú de navegaciónLas claves del sistema electoral en...