Function

  • Hi everybody,

    This is really complicated and i need your help

    Create a function named loadQueryResults() exists that will, when assigned as the value of an array variable, load the results of the following query into that array:

    "SELECT name from users"

    a) Write code that will use the function to load the results of the query to an array, and echo to the screen the number of users with a name value of "Francois".

    Is this involves creating user defined function?How to use array in that?

    thanks

  • Another part of your homework assignment?

    Since SQL doesn't have arrays, this section most probably is about a frontend dev.

    In case your tutor is teaching you that arrays are part of an RDBMS, I'd strongly recommend to skip that class...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • daveriya (2/26/2011)


    Create a function named loadQueryResults() exists that will, when assigned as the value of an array variable, load the results of the following query into that array:

    "SELECT name from users"

    a) Write code that will use the function to load the results of the query to an array, and echo to the screen the number of users with a name value of "Francois".

    That's not clear enough for me to understand. Can you try to make it clearer and provide some sample data please? It might be asking you to do something with Table-Valued Parameters, but without clarification from you, I am just guessing.

  • LutzM (2/26/2011)


    Another part of your homework assignment?

    Since SQL doesn't have arrays, this section most probably is about a frontend dev.

    In case your tutor is teaching you that arrays are part of an RDBMS, I'd strongly recommend to skip that class...

    Maybe this will stir up a hornet's nest...

    By playing devils advocate, could it not easily be argued that RDBMS is all about arrays? Sure we don't call them arrays and I am no studied mathematician but I would find it easy to believe that arrays will form part of set theory. Is the difference between an array and a dataset not just a matter of semantics?

  • diamondgm (2/26/2011)


    Maybe this will stir up a hornet's nest...

    By playing devils advocate, could it not easily be argued that RDBMS is all about arrays? Sure we don't call them arrays and I am no studied mathematician but I would find it easy to believe that arrays will form part of set theory. Is the difference between and array and a dataset not just a matter of semantics?

    We could go on to discuss how there are no sets in SQL Server anyway, because all operations are ultimately row-by-row, even the so-called set-based joins like hash and merge. We should probably concentrate on answering the poster's question first, however 😉

  • SQLkiwi (2/26/2011)


    diamondgm (2/26/2011)


    Maybe this will stir up a hornet's nest...

    By playing devils advocate, could it not easily be argued that RDBMS is all about arrays? Sure we don't call them arrays and I am no studied mathematician but I would find it easy to believe that arrays will form part of set theory. Is the difference between and array and a dataset not just a matter of semantics?

    We could go on to discuss how there are no sets in SQL Server anyway, because all operations are ultimately row-by-row, even the so-called set-based joins like hash and merge. We should probably concentrate on answering the poster's question first, however 😉

    It would depend on what level of abstraction you choose to analyse the system at.

    Regarding helping the poster's question:

    1. I have nothing constructive to contribute w.r.t. a question that seems to require an answer in another language

    2. It would seem that we are waiting on the poster for more info.

    Until we have said info, is it in bad taste for me to remark on responses? If so, I apologise.

  • diamondgm (2/26/2011)


    I apologise.

    No worries.

  • In case your tutor is teaching you that arrays are part of an RDBMS, I'd strongly recommend to skip that class...

    LOL!

Viewing 8 posts - 1 through 7 (of 7 total)

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