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

  • SEARCH
  • Home
  • 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 7193869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:15:25+00:00 2026-05-28T20:15:25+00:00

Was: How to back up selected stored procedure using query I would like to

  • 0

Was: How to back up selected stored procedure using query

I would like to backup 10 out of 200 stores procedures over command line ( In SQL Server Management Studio). Is there an easy way to do it?

Right now I am using the Database->Tasks->Generate Scripts option, that takes me through a series of dialog where I choose the SP that I want to export. I would like to make this process easy, so I don’t have to do it all over again.

Note: By Export I mean just print it on the screen so I can copy it and save it in a text file.

  • 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-28T20:15:26+00:00Added an answer on May 28, 2026 at 8:15 pm

    How about using INFORMATION_SCHEMA.Routines ?

    DECLARE MY_CURSOR Cursor
    FOR
    SELECT r.Routine_Definition
    FROM INFORMATION_SCHEMA.Routines r 
    OPEN MY_CURSOR
        DECLARE @sproc VARCHAR(MAX) 
        FETCH NEXT FROM MY_CURSOR INTO @sproc
        WHILE (@@FETCH_STATUS <> -1)
        BEGIN
            IF (@@FETCH_STATUS <> -2)
            PRINT @sproc
            FETCH NEXT FROM MY_CURSOR INTO @sproc
        END
    CLOSE MY_CURSOR
    DEALLOCATE MY_CURSOR
    GO
    

    EDIT

    It sounds like you might want something like this to include the LAST_ALTERED date and Definition in a result set.

    SELECT
        r.LAST_ALTERED,
        r.ROUTINE_NAME,
        r.Routine_Definition
    FROM INFORMATION_SCHEMA.Routines r 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Back in VB6, I wrote a few functions that would let me code without
Back in the 90s when I first started out with MFC I used to
Back in college I wrote a game where the computer would sleep for 1
I have a form that a user would fill out while creating a ticket
I would like to store data temporarily on clientside. What is the best way
I have the following stored procedure: ALTER PROCEDURE [dbo].[spTitle_GetTitleById] ( @TitleId INT ) AS
Is it possible to send n ints to a stored procedure as parameters? The
How to post back selected Category item from html.dropdownlist to the browse action method
I have the following stored procedure which takes a user ID, a starting date,
Back in the old days, Help was not trivial but possible: generate some funky

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.