Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2010
    Posts
    153

    Smile Unanswered: function returning multiple values.

    I have a table called tableA and i am fetching 10 rows from table.

    select dept_id from tableA where branch = 'Chennai';

    I got 10 records.

    dept_id
    -------
    001
    002
    003
    004
    005
    so n.....


    Now i want to pass these dept_ids dynamically to a function paramter.

    ie. exec function_name (@dept_id).


    How do i write a function?

    I need it urgently.

    Thanks

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    I think you mean "stored procedure", rather than a "function". Look up Table Valued Paramters.

  3. #3
    Join Date
    Sep 2010
    Posts
    153

    Smile

    function or procedure anything will do. I need it urgently. Function preferable..
    select function_name (@parameter)thanks a lot

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'm not sure how to help you with this kind of question. Without more insight into what you are trying to accomplish I can't say for sure, but this sounds like a design that SQL Server doesn't support very well.

    Please describe what you want to do using English, without worrying about how to write code. Once we understand what you are trying to do, then we can help you accomplish the task as easily as possible.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •