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 7668923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:28:47+00:00 2026-05-31T15:28:47+00:00

I need to run a test on stored procedure in a client’s database. Is

  • 0

I need to run a test on stored procedure in a client’s database. Is there anyway to test the stored procedure without affecting the data in the database?

For example, there is an insert query in the SP, which will change the data of the database.

Is there anyway to solve this problem?

  • 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-31T15:28:49+00:00Added an answer on May 31, 2026 at 3:28 pm

    You could run the stored procedure in a transaction. Use this script by placing your statements between the comment lines. Run the whole script, your transaction will be in an uncommitted state. Then, highlight the line ROLLBACK or COMMIT and execute either accordingly to finish.

    Always have backups.

    If possible work in a sandbox away from your clients data as a matter of principle.

    Be aware that you could be locking data which could be holding up other sql statements by your client while you are deciding whether to commit or rollback.

    BEGIN TRANSACTION MyTransaction
    GO
    
    -- INSERT SQL BELOW
    
    
    -- INSERT SQL ABOVE
    
    GO
    IF @@ERROR != 0
    BEGIN
            PRINT '--------- ERROR - ROLLED BACK ---------'
            ROLLBACK TRANSACTION MyTransaction
    END
    ELSE
    BEGIN
            PRINT '--------- SCRIPT EXECUTE VALID ---------'
            PRINT '--------- COMPLETE WITH ROLLBACK OR COMMIT NOW! ---------'
            --ROLLBACK TRANSACTION MyTransaction
            --COMMIT TRANSACTION MyTransaction
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to run a stored procedure from a C# application. I use the
I need to run this line from my c++ program: java -jar test.jar text1
I need to use the ReSharper Unit Test Runner to run my MSTest Unit
I run my development environment in a VM and need to test the delivery
i need run code that will create a database and populate tables. i am
I need to run a RLIKE query on a database mmoved from MySQL to
I need to run in parallel multiple threads to perform some tests. My 'test
http://en.wikipedia.org/wiki/Upsert Insert Update stored proc on SQL Server Is there some clever way to
I am trying to run a stored procedure from Excel. I know how to
One of my unit tests is driven by test data, stored in src/test/resources/testData.txt .

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.