Home All Groups Group Topic Archive Search About

How to optimize SMO and looping thru SPs

Author
20 Mar 2007 8:28 AM
moondaddy
I have a method (in c#3.0) which loops through all the SPs in a sql05 db and
adds them to a tree control.  my problem is that I only have about 100 SP,
but it takes for ever because its looping through all the system SPs as
well.  is there a flag I can use so the database object only returns use
defined SPs?  Here's my code:

foreach (StoredProcedure procedure in database.StoredProcedures)
{
    if (!(procedure.IsSystemObject))
    {
        newObject = new TreeNode(procedure.Name);
        newGroup.Nodes.Add(newObject);
    }
}

Thanks.

--
moondaddy@noemail.noemail

AddThis Social Bookmark Button