Multiple value from one parameter

  • Hi

    I need to write a store procedure in which i can chosse multiple values.

    eg I need to show more then one customer data.

    I am using SQL Server 2000

    Thanks.

  • You're welcome

    Is there anything in particular you're wondering about?

    As a starting point, you can go to BOL (Books On Line) and look up 'CREATE PROCEDURE'.

    /Kenneth

  • Once again thanks

    CREATE PROCEDURE Customerspend

        @Year As nvarchar,@Customer As nvarchar (8), @Major as nvarchar (3)

    AS

    SELECT     Billing.Customer, Billing.ItemCode,Item.ItemGroupMajor, BillingF.QuantityInvoiced, Billing.InvoicedValueBase, TimeDates.Month

    FROM         Billing INNER JOIN

                          TimeDates ON Billing.DateInvoiced = TimeDates.S21Date INNER JOIN

                          Item ON Billing.ItemCode = Item.ItemCode

           WHERE     (TimeDates.Year = @Year) AND (NBillingF.Customer = Customer)

    ORDER BY

            Customer,KQ.ItemGroupMajor

    GO

    I need to select ItemGroupMajor like @Major= In(....,......,......,)

    Means user can enter any number of values.

    Need to select multivalues with one parameter ..

     

  • Hi Vandy,

    this is a very frequent question on these forums. I'm sure you'll be able to find several topics about this problem, like for example http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=303442

    However, the best recommendation is IMHO to read Erland Sommarskog's pages, especially article "Arrays and Lists in SQL Server". It deals precisely with this problem and contains lots of useful information.

    HTH

    Vladan

  • Many Thanks Vladan

     

     

     

Viewing 5 posts - 1 through 4 (of 4 total)

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