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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:51:11+00:00 2026-05-17T00:51:11+00:00

This test checks if only one SP ends with Insert, Load, or Save, then

  • 0

This test checks if only one SP ends with Insert, Load, or Save, then it’s successful.

//Query to find SPs for a certain Table name
string check_SP =
    "SELECT ROUTINE_NAME, ROUTINE_DEFINITION " +
    "FROM INFORMATION_SCHEMA.ROUTINES " +
    "WHERE ROUTINE_DEFINITION LIKE '%CLNT_" + Table_Name + "%' " +
    "AND ROUTINE_TYPE='PROCEDURE'";

conn2.Open();
SqlCommand cmd_SP = new SqlCommand(check_SP, conn2);
list_SP = cmd_SP.ExecuteReader(); //Write 'check_SP' query results to 'list_SP'

while (list_SP.Read())
{
    if (list_SP[0].ToString().EndsWith("Insert")
        || list_SP[0].ToString().EndsWith("Load")
        || list_SP[0].ToString().EndsWith("Save"))
    {
        Console.WriteLine(list_SP[0]);
        test = true;
    }
    else
    {
        Console.WriteLine("Missing SP");
        test = false;
        break;
    }                    
}

What I wanna do is to break the while loop whenever there is no Stored Procedure that ends with Insert, or Load, or Save. (i.e. Each table should have at least these three SPs or else the test will fail)

  • 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-17T00:51:11+00:00Added an answer on May 17, 2026 at 12:51 am

    Leaving aside whether this is the right way to do this or not, you’ll need to change your logic to check for the existence of each type of procedure individually:

    bool insertExists = false;
    bool loadExists = false;
    bool saveExists = false;
    while (list_SP.Read())
    {
        if (list_SP[0].ToString().EndsWith("Insert"))
        {
            insertExists = true;
        }
        if (list_SP[0].ToString().EndsWith("Load"))
        {
            loadExists = true;
        }
        if (list_SP[0].ToString().EndsWith("Save"))
        {
            saveExists = true;
        }
        if (insertExists && loadExists && saveExists)
        {
            Console.WriteLine("All three exist");
            break;
        }
    }
    
    if (!insertExists)
    {
        Console.WriteLine("Missing insert");
    }
    if (!loadExists)
    {
        Console.WriteLine("Missing load");
    }
    if (!saveExists)
    {
        Console.WriteLine("Missing save");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone tell me why this unit test that checks for exceptions fails? Obviously
In this test Core Data project, I have a one to many relationship from
My goal is to install only one WAR file but to use test or
I'm trying to solve this issue with only one select. It can be easily
check this out: template <class T> class Test: public T { public: void TestFunc()
My point is this. For test i need when user check chk1 the chk2
On this test page: http:// www.onebagoneearth.com/ Products-test , where it says oboe love series,
I have this test slider http://jsfiddle.net/dUyLY/2/ In Chrome it works nice, but in firefox
Why doesn't this test case work? <?php // cards with cyrillic inidices and suits
I have this test [Test] public void SaveInventoryItemLoad_Will_Call_WCF_Service_SaveInventoryItemLoad() { adapter.SaveInventoryItemLoad(new List<InventoryItemLoadProxy>()); itemMasterBusinessClientMock.Verify(x => x.SaveInventoryItemLoad(It.IsAny<List<InventoryItemLoadProxy>>()),

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.