Stored Procedures

  • I could really use some help with this!

    Create a stored procedure named spBalanceRange that accepts three optional parameters. The procedure returns a result set consisting of VendorName, InvoiceNumber, and Balance for each invoice with a balance due, sorted with largest balance due first. The parameter @VendorVar is a mask that's used with a LIKE operator to filter by vendor name. @BalanceMin and @BalanceMax are parameters used to specify the requested range of balances due. If called with no parameters, the procedure should return all invoices with a balance due.

    I am using SQL server 2008, here is what I have so far.

    Create Proc spBalanceRange

    @VendorVar VarChar(40) = '%',

    @BalanceMin money = null,

    @BalanceMax money = null

    AS

    IF @BalanceMin IS Null

    Select @BalanceMin = Min(InvoiceTotal )

    From Invoices

    Select @BalanceMax = Max(InvoiceTotal )

    From Invoices Join Vendors

    On Invoices.VendorID = Vendors.VendorID

    Where (InvoiceTotal >= @BalanceMin) AND

    (Vendorname Like @VendorVar)

  • pls dont multiple post

    seems that if you google

    "Create a stored procedure named spBalanceRange that accepts three optional parameters."

    you may find what you are looking for.....

    if not or confused pls post back

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • Thank you, I had actually use 'google' in order to get the result you were referring to. I had been using firefox and it didn't show me that. Thanks Again!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply