Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7181665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:36:19+00:00 2026-05-28T17:36:19+00:00

I developed an application where users can select specific tables to do backup and

  • 0

I developed an application where users can select specific tables to do backup and export to textfile for selected database and selected server.

My form contains a list of servers available within the network and on user selection of server corresponding databases will be displayed and when user selects the database then corresponding tables will be displayed and user can select the tables he want to do backup and when enters execute button it does all backup and exports to a text file.

Now I want to modify my program slightly when user selects database,if database contains stored procedures it should display list of all stored procedures in the selected database and should do the backup of them and export to a textfile.

Please give me any ideas to achieve this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:36:20+00:00Added an answer on May 28, 2026 at 5:36 pm

    you could use the SMO namespace which contains all you need to do that and much more

    Add a reference to that namespace first

    using System;
    using System.Collections.Generic;
    using System.Data;
    using Microsoft.SqlServer.Management.Smo;
    
    
          Server server = new Server(@[yourServer]);
          Database db = server.Databases[yourdatabase];
          List<SqlSmoObject> list = new List<SqlSmoObject>();
          DataTable dataTable = db.EnumObjects(DatabaseObjectTypes.StoredProcedure);
          foreach (DataRow row in dataTable.Rows)
          {
             string sSchema = (string)row["Schema"];
             if (sSchema == "sys" || sSchema == "INFORMATION_SCHEMA")
                continue;
             StoredProcedure sp = (StoredProcedure)server.GetSmoObject(
                new Urn((string)row["Urn"]));
             if (!sp.IsSystemObject)
                list.Add(sp);
          }
          Scripter scripter = new Scripter();
          scripter.Server = server;
          scripter.Options.IncludeHeaders = true;
          scripter.Options.SchemaQualify = true;
          scripter.Options.ToFileOnly = true;
          scripter.Options.FileName = @"C:\fileName.sql";
          scripter.Script(list.ToArray());
    

    more info at

    http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've developed an application that users can use to store lists of their favourite
I have a web application developed using PHP. I want my users to select
I develop desktop-based WPF-application, that uses SQL Server 2008 R2 Database and ADO.NET Entity
I have developed a C# form based application. It consists of a number of
I need to implement a dialog for a web application (ASP.NET/C#) where users can
There are several packages in my application that user can select each one according
I've never developed a web application that uses distributed memory. Is it common practice
We developed an application to edit the web.config settings. The user has to locate
I've developed an application at working using MySQL 5, that uses Views to access
I have developed a C# WinForms application whereby the user is providing input via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.