manipulate the result returned from a stored procedure

  • Hi,

    I am looking for a way to manipulate the result returned from a stored procedure (built-in or user created). The manipulation might be sorting, grouping, or select by criteria or etc.

    i know that i can create a temp table and insert the result like this

    [font="Courier New"] create table #tmp (

    idxint,

    namevarchar(100),

    int_valint,

    vervarchar(15)

    )

    insert #tmp

    exec master.dbo.xp_msver[/font]

    and the make use of the temp table, but i am looking for a more convenient way

    select * from function_i_am_looking_for("xp_msver") where character_value = 'xxxxx'

    it there any other way to do what i want? thanks:-)

  • Forr (10/30/2009)


    select * from function_i_am_looking_for("xp_msver") where character_value = 'xxxxx'

    it there any other way to do what i want? thanks:-)

    I am heavily against the use of functions like this.

    Think about it.

    You have a function that returns a million rows, you then filter out the 5 you are interested in.

    Thats 999,995 rows sqlserver has processed that if doesnt need to.

    Its much more efficient to only process the rows you are interested in in the first place.

    Yes this is an extreme example

    But to answer you question directly try this

    http://www.sqlservercentral.com/articles/T-SQL/68233/



    Clear Sky SQL
    My Blog[/url]

  • thanks Mr or Mrs. 500, i can see your point.

    for the method u referred, i have read that before and i don't think i can create any objects...

    thanks very much!!:-D

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

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