SQL Server: Why do use SMO?












9















I have been working with SQL Server for a couple of years. I have heard about SMO but I don't know anything about it. What are the benefits of using it? Should I learn and start using SMO in my SQL Server projects (mainly data warehouse development)? Why?










share|improve this question



























    9















    I have been working with SQL Server for a couple of years. I have heard about SMO but I don't know anything about it. What are the benefits of using it? Should I learn and start using SMO in my SQL Server projects (mainly data warehouse development)? Why?










    share|improve this question

























      9












      9








      9








      I have been working with SQL Server for a couple of years. I have heard about SMO but I don't know anything about it. What are the benefits of using it? Should I learn and start using SMO in my SQL Server projects (mainly data warehouse development)? Why?










      share|improve this question














      I have been working with SQL Server for a couple of years. I have heard about SMO but I don't know anything about it. What are the benefits of using it? Should I learn and start using SMO in my SQL Server projects (mainly data warehouse development)? Why?







      sql sql-server sql-server-2005 sql-server-2008 smo






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 25 '10 at 19:05









      juurjuur

      2,367102634




      2,367102634
























          4 Answers
          4






          active

          oldest

          votes


















          5














          It depends on what you're trying to do. SMO is SQL Server Management Objects. It is a set of libraries for managing SQL Server programmatically. For example if you're trying to build a clone of SQL Maangement Studio then SMO is something you probably want to look into. OR if you're trying to manpulate the structure of your database programmatically then that's the place to look.



          Otherwise, I wouldn't bother.






          share|improve this answer



















          • 5





            There are a lot more use cases than that, e.g., programmatically extracting the DDL for your database objects.

            – RedFilter
            Nov 25 '10 at 20:23



















          6














          From Microsoft:



          Overview (SMO)




          SQL Server Management Objects (SMO)
          are objects designed for programmatic
          management of Microsoft SQL Server.
          You can use SMO to build customized
          SQL Server management applications.
          Although SQL Server Management Studio
          is a powerful and extensive
          application for managing SQL Server,
          there might be times when you would be
          better served by an SMO application.



          For example, the user applications
          that control the SQL Server management
          tasks might have to be simplified to
          meet the needs of new users and to
          reduce training costs. You might have
          to create customized SQL Server
          databases, or create an application
          for creating and monitoring the
          efficiency of indexes. An SMO
          application might also be used to
          include third-party hardware or
          software seamlessly into the database
          management application.



          The SMO object model extends and
          supersedes the Distributed Management
          Objects (SQL-DMO) object model.
          Compared to SQL-DMO, SMO increases
          performance, control, and ease of use.
          Most SQL-DMO functionality is included
          in SMO, and there are various new
          classes that support new features in
          SQL Server. The object model is
          intuitive and uses SQL-DMO
          terminology, where it is possible, to
          help transfer your skills.




          You can download SMO here:



          Microsoft® SQL Server® 2008 R2 Feature Pack



          And for getting started programming:



          Creating SMO Programs






          share|improve this answer


























          • Thanks, what do I need to start using SMO? Do I need full Visual Studio 2008 or is SMO included in SQL Server 2008 EE?

            – juur
            Nov 25 '10 at 19:15











          • @juur: see my update

            – RedFilter
            Nov 25 '10 at 20:11



















          3














          I have used SMO to automatically script out object code and user permissions and add to version control.



          By doing this I can save privileges or object DDL as of a point in time for my auditing team or my own research or for cloning a server.



          I also use it so I can quickly compare object code from specific dates without needing a snapshot / backup.



          Recently I used SMO in a Disaster Recovery Project to script out all Server Permissions and System Database Object Permissions and run the script on the replacement server.






          share|improve this answer
























          • I do this as well. SqlPubWiz was the only option before this.

            – Paul Draper
            Mar 21 '13 at 17:18





















          0














          I've recently created an POS/Work Order Management application with a SQL database backend and the SMO library. The SMO gave my a application a lot of flexibility to control the database in terms of work order records, user's records an even my own set of user roles. Helping me to differentiate SQL users when managing a specific database. So, my take is that it all depends on the extend of your use of SQL and how much you may need to automate and control certain aspects of your SQL database.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2fstackoverflow.com%2fquestions%2f4280174%2fsql-server-why-do-use-smo%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            5














            It depends on what you're trying to do. SMO is SQL Server Management Objects. It is a set of libraries for managing SQL Server programmatically. For example if you're trying to build a clone of SQL Maangement Studio then SMO is something you probably want to look into. OR if you're trying to manpulate the structure of your database programmatically then that's the place to look.



            Otherwise, I wouldn't bother.






            share|improve this answer



















            • 5





              There are a lot more use cases than that, e.g., programmatically extracting the DDL for your database objects.

              – RedFilter
              Nov 25 '10 at 20:23
















            5














            It depends on what you're trying to do. SMO is SQL Server Management Objects. It is a set of libraries for managing SQL Server programmatically. For example if you're trying to build a clone of SQL Maangement Studio then SMO is something you probably want to look into. OR if you're trying to manpulate the structure of your database programmatically then that's the place to look.



            Otherwise, I wouldn't bother.






            share|improve this answer



















            • 5





              There are a lot more use cases than that, e.g., programmatically extracting the DDL for your database objects.

              – RedFilter
              Nov 25 '10 at 20:23














            5












            5








            5







            It depends on what you're trying to do. SMO is SQL Server Management Objects. It is a set of libraries for managing SQL Server programmatically. For example if you're trying to build a clone of SQL Maangement Studio then SMO is something you probably want to look into. OR if you're trying to manpulate the structure of your database programmatically then that's the place to look.



            Otherwise, I wouldn't bother.






            share|improve this answer













            It depends on what you're trying to do. SMO is SQL Server Management Objects. It is a set of libraries for managing SQL Server programmatically. For example if you're trying to build a clone of SQL Maangement Studio then SMO is something you probably want to look into. OR if you're trying to manpulate the structure of your database programmatically then that's the place to look.



            Otherwise, I wouldn't bother.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 25 '10 at 19:10









            Jeff HornbyJeff Hornby

            9,55833148




            9,55833148








            • 5





              There are a lot more use cases than that, e.g., programmatically extracting the DDL for your database objects.

              – RedFilter
              Nov 25 '10 at 20:23














            • 5





              There are a lot more use cases than that, e.g., programmatically extracting the DDL for your database objects.

              – RedFilter
              Nov 25 '10 at 20:23








            5




            5





            There are a lot more use cases than that, e.g., programmatically extracting the DDL for your database objects.

            – RedFilter
            Nov 25 '10 at 20:23





            There are a lot more use cases than that, e.g., programmatically extracting the DDL for your database objects.

            – RedFilter
            Nov 25 '10 at 20:23













            6














            From Microsoft:



            Overview (SMO)




            SQL Server Management Objects (SMO)
            are objects designed for programmatic
            management of Microsoft SQL Server.
            You can use SMO to build customized
            SQL Server management applications.
            Although SQL Server Management Studio
            is a powerful and extensive
            application for managing SQL Server,
            there might be times when you would be
            better served by an SMO application.



            For example, the user applications
            that control the SQL Server management
            tasks might have to be simplified to
            meet the needs of new users and to
            reduce training costs. You might have
            to create customized SQL Server
            databases, or create an application
            for creating and monitoring the
            efficiency of indexes. An SMO
            application might also be used to
            include third-party hardware or
            software seamlessly into the database
            management application.



            The SMO object model extends and
            supersedes the Distributed Management
            Objects (SQL-DMO) object model.
            Compared to SQL-DMO, SMO increases
            performance, control, and ease of use.
            Most SQL-DMO functionality is included
            in SMO, and there are various new
            classes that support new features in
            SQL Server. The object model is
            intuitive and uses SQL-DMO
            terminology, where it is possible, to
            help transfer your skills.




            You can download SMO here:



            Microsoft® SQL Server® 2008 R2 Feature Pack



            And for getting started programming:



            Creating SMO Programs






            share|improve this answer


























            • Thanks, what do I need to start using SMO? Do I need full Visual Studio 2008 or is SMO included in SQL Server 2008 EE?

              – juur
              Nov 25 '10 at 19:15











            • @juur: see my update

              – RedFilter
              Nov 25 '10 at 20:11
















            6














            From Microsoft:



            Overview (SMO)




            SQL Server Management Objects (SMO)
            are objects designed for programmatic
            management of Microsoft SQL Server.
            You can use SMO to build customized
            SQL Server management applications.
            Although SQL Server Management Studio
            is a powerful and extensive
            application for managing SQL Server,
            there might be times when you would be
            better served by an SMO application.



            For example, the user applications
            that control the SQL Server management
            tasks might have to be simplified to
            meet the needs of new users and to
            reduce training costs. You might have
            to create customized SQL Server
            databases, or create an application
            for creating and monitoring the
            efficiency of indexes. An SMO
            application might also be used to
            include third-party hardware or
            software seamlessly into the database
            management application.



            The SMO object model extends and
            supersedes the Distributed Management
            Objects (SQL-DMO) object model.
            Compared to SQL-DMO, SMO increases
            performance, control, and ease of use.
            Most SQL-DMO functionality is included
            in SMO, and there are various new
            classes that support new features in
            SQL Server. The object model is
            intuitive and uses SQL-DMO
            terminology, where it is possible, to
            help transfer your skills.




            You can download SMO here:



            Microsoft® SQL Server® 2008 R2 Feature Pack



            And for getting started programming:



            Creating SMO Programs






            share|improve this answer


























            • Thanks, what do I need to start using SMO? Do I need full Visual Studio 2008 or is SMO included in SQL Server 2008 EE?

              – juur
              Nov 25 '10 at 19:15











            • @juur: see my update

              – RedFilter
              Nov 25 '10 at 20:11














            6












            6








            6







            From Microsoft:



            Overview (SMO)




            SQL Server Management Objects (SMO)
            are objects designed for programmatic
            management of Microsoft SQL Server.
            You can use SMO to build customized
            SQL Server management applications.
            Although SQL Server Management Studio
            is a powerful and extensive
            application for managing SQL Server,
            there might be times when you would be
            better served by an SMO application.



            For example, the user applications
            that control the SQL Server management
            tasks might have to be simplified to
            meet the needs of new users and to
            reduce training costs. You might have
            to create customized SQL Server
            databases, or create an application
            for creating and monitoring the
            efficiency of indexes. An SMO
            application might also be used to
            include third-party hardware or
            software seamlessly into the database
            management application.



            The SMO object model extends and
            supersedes the Distributed Management
            Objects (SQL-DMO) object model.
            Compared to SQL-DMO, SMO increases
            performance, control, and ease of use.
            Most SQL-DMO functionality is included
            in SMO, and there are various new
            classes that support new features in
            SQL Server. The object model is
            intuitive and uses SQL-DMO
            terminology, where it is possible, to
            help transfer your skills.




            You can download SMO here:



            Microsoft® SQL Server® 2008 R2 Feature Pack



            And for getting started programming:



            Creating SMO Programs






            share|improve this answer















            From Microsoft:



            Overview (SMO)




            SQL Server Management Objects (SMO)
            are objects designed for programmatic
            management of Microsoft SQL Server.
            You can use SMO to build customized
            SQL Server management applications.
            Although SQL Server Management Studio
            is a powerful and extensive
            application for managing SQL Server,
            there might be times when you would be
            better served by an SMO application.



            For example, the user applications
            that control the SQL Server management
            tasks might have to be simplified to
            meet the needs of new users and to
            reduce training costs. You might have
            to create customized SQL Server
            databases, or create an application
            for creating and monitoring the
            efficiency of indexes. An SMO
            application might also be used to
            include third-party hardware or
            software seamlessly into the database
            management application.



            The SMO object model extends and
            supersedes the Distributed Management
            Objects (SQL-DMO) object model.
            Compared to SQL-DMO, SMO increases
            performance, control, and ease of use.
            Most SQL-DMO functionality is included
            in SMO, and there are various new
            classes that support new features in
            SQL Server. The object model is
            intuitive and uses SQL-DMO
            terminology, where it is possible, to
            help transfer your skills.




            You can download SMO here:



            Microsoft® SQL Server® 2008 R2 Feature Pack



            And for getting started programming:



            Creating SMO Programs







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 25 '10 at 20:22

























            answered Nov 25 '10 at 19:09









            RedFilterRedFilter

            135k30242255




            135k30242255













            • Thanks, what do I need to start using SMO? Do I need full Visual Studio 2008 or is SMO included in SQL Server 2008 EE?

              – juur
              Nov 25 '10 at 19:15











            • @juur: see my update

              – RedFilter
              Nov 25 '10 at 20:11



















            • Thanks, what do I need to start using SMO? Do I need full Visual Studio 2008 or is SMO included in SQL Server 2008 EE?

              – juur
              Nov 25 '10 at 19:15











            • @juur: see my update

              – RedFilter
              Nov 25 '10 at 20:11

















            Thanks, what do I need to start using SMO? Do I need full Visual Studio 2008 or is SMO included in SQL Server 2008 EE?

            – juur
            Nov 25 '10 at 19:15





            Thanks, what do I need to start using SMO? Do I need full Visual Studio 2008 or is SMO included in SQL Server 2008 EE?

            – juur
            Nov 25 '10 at 19:15













            @juur: see my update

            – RedFilter
            Nov 25 '10 at 20:11





            @juur: see my update

            – RedFilter
            Nov 25 '10 at 20:11











            3














            I have used SMO to automatically script out object code and user permissions and add to version control.



            By doing this I can save privileges or object DDL as of a point in time for my auditing team or my own research or for cloning a server.



            I also use it so I can quickly compare object code from specific dates without needing a snapshot / backup.



            Recently I used SMO in a Disaster Recovery Project to script out all Server Permissions and System Database Object Permissions and run the script on the replacement server.






            share|improve this answer
























            • I do this as well. SqlPubWiz was the only option before this.

              – Paul Draper
              Mar 21 '13 at 17:18


















            3














            I have used SMO to automatically script out object code and user permissions and add to version control.



            By doing this I can save privileges or object DDL as of a point in time for my auditing team or my own research or for cloning a server.



            I also use it so I can quickly compare object code from specific dates without needing a snapshot / backup.



            Recently I used SMO in a Disaster Recovery Project to script out all Server Permissions and System Database Object Permissions and run the script on the replacement server.






            share|improve this answer
























            • I do this as well. SqlPubWiz was the only option before this.

              – Paul Draper
              Mar 21 '13 at 17:18
















            3












            3








            3







            I have used SMO to automatically script out object code and user permissions and add to version control.



            By doing this I can save privileges or object DDL as of a point in time for my auditing team or my own research or for cloning a server.



            I also use it so I can quickly compare object code from specific dates without needing a snapshot / backup.



            Recently I used SMO in a Disaster Recovery Project to script out all Server Permissions and System Database Object Permissions and run the script on the replacement server.






            share|improve this answer













            I have used SMO to automatically script out object code and user permissions and add to version control.



            By doing this I can save privileges or object DDL as of a point in time for my auditing team or my own research or for cloning a server.



            I also use it so I can quickly compare object code from specific dates without needing a snapshot / backup.



            Recently I used SMO in a Disaster Recovery Project to script out all Server Permissions and System Database Object Permissions and run the script on the replacement server.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 28 '11 at 23:39









            John DaCostaJohn DaCosta

            3,47922325




            3,47922325













            • I do this as well. SqlPubWiz was the only option before this.

              – Paul Draper
              Mar 21 '13 at 17:18





















            • I do this as well. SqlPubWiz was the only option before this.

              – Paul Draper
              Mar 21 '13 at 17:18



















            I do this as well. SqlPubWiz was the only option before this.

            – Paul Draper
            Mar 21 '13 at 17:18







            I do this as well. SqlPubWiz was the only option before this.

            – Paul Draper
            Mar 21 '13 at 17:18













            0














            I've recently created an POS/Work Order Management application with a SQL database backend and the SMO library. The SMO gave my a application a lot of flexibility to control the database in terms of work order records, user's records an even my own set of user roles. Helping me to differentiate SQL users when managing a specific database. So, my take is that it all depends on the extend of your use of SQL and how much you may need to automate and control certain aspects of your SQL database.






            share|improve this answer




























              0














              I've recently created an POS/Work Order Management application with a SQL database backend and the SMO library. The SMO gave my a application a lot of flexibility to control the database in terms of work order records, user's records an even my own set of user roles. Helping me to differentiate SQL users when managing a specific database. So, my take is that it all depends on the extend of your use of SQL and how much you may need to automate and control certain aspects of your SQL database.






              share|improve this answer


























                0












                0








                0







                I've recently created an POS/Work Order Management application with a SQL database backend and the SMO library. The SMO gave my a application a lot of flexibility to control the database in terms of work order records, user's records an even my own set of user roles. Helping me to differentiate SQL users when managing a specific database. So, my take is that it all depends on the extend of your use of SQL and how much you may need to automate and control certain aspects of your SQL database.






                share|improve this answer













                I've recently created an POS/Work Order Management application with a SQL database backend and the SMO library. The SMO gave my a application a lot of flexibility to control the database in terms of work order records, user's records an even my own set of user roles. Helping me to differentiate SQL users when managing a specific database. So, my take is that it all depends on the extend of your use of SQL and how much you may need to automate and control certain aspects of your SQL database.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 '18 at 18:39









                SierraSierra

                113




                113






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • 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%2fstackoverflow.com%2fquestions%2f4280174%2fsql-server-why-do-use-smo%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

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)