How to insert 1 to count rows into temp table based on a count in another table

  • Hoping someone can help me.

    I am trying to create a function that will return a table result that will have ID and COUNT. I am trying to create a temp table in a function that will return something as follows:

    ID count

    a 1

    a 2

    a 3

    b 1

    b 2

    c 1

    c 2

    c 3

    c 4

    c 5

    ...

    The ID is the ID of a receiving record and I want the count to go from 1 to the Qty Received in the database table. I will then use this to generate a grouping on a crystal report to print out 1 label for each item received.

    Can someone help me out with this?

  • Please don't cross post. It just wastes peoples time and fragments replies.

    No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic1001678-1291-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (10/9/2010)


    Please don't cross post. It just wastes peoples time and fragments replies.

    No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic1001678-1291-1.aspx

    Not only is cross posting a bad idea, please post your questions in the proper section. The question posted does not have any apparent connection with Integration Services.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

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

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