how can i insert in udf

  • hbtkp (4/17/2012)


    ok ,i m giving sample date this time

    this TIME I AM GIVIng SAMPLE DATA plz help

    MemberID index

    -9 0

    NULL null

    -9 0

    NULL null

    NULL nul

    i need to go each of the value who has -9 and 0 ,using loop

    that looks like sample output from your current stored procedures and functions that are currently not working. again please read this article http://qa.sqlservercentral.com/articles/Best+Practices/61537/ and help us help you.

    and for that "Sample data" you dont need a loop to get all the members with an id of -9

    SELECT * FROM sometable WHERE MemberID = -9

    EDIT: put url tags


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • no this i need to do from udf which returns table

    and i need to put in while or for condition

  • hbtkp (4/17/2012)


    no this i need to do from udf which returns table

    and i need to put in while or for condition

    Select count(*) from TimesAskedForDDL_AndSampleData where UserName = 'hbtkp'

    Msg 8115, Level 16, State 2, Line 1

    Arithmetic overflow error converting expression to data type bigint.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (4/16/2012)


    hbtkp (4/16/2012)


    i dont know what is cumulative formula.

    but this is how i am getting my final data in report.

    so based on how they calculate , i need to do implement that formula in sql.

    this result is accurate.i need to figure out formula based on that

    Well how do you expect somebody else to help with a formula when you can't explain how to calculate it?

    Let me try to paraphrase in extremely clear english what your questions is.

    The chemical billfold yields to a crazy accent. Behind the fan waits my dress. The infant mortal pilots an ace near a stretch wash. A farewell word sneaks with the exit.

    Meh. Would have been better as a haiku

    I'm a DBA.
    I'm not paid to solve problems. I'm paid to prevent them.

  • andrew gothard (4/17/2012)


    Sean Lange (4/16/2012)


    hbtkp (4/16/2012)


    i dont know what is cumulative formula.

    but this is how i am getting my final data in report.

    so based on how they calculate , i need to do implement that formula in sql.

    this result is accurate.i need to figure out formula based on that

    Well how do you expect somebody else to help with a formula when you can't explain how to calculate it?

    Let me try to paraphrase in extremely clear english what your questions is.

    The chemical billfold yields to a crazy accent. Behind the fan waits my dress. The infant mortal pilots an ace near a stretch wash. A farewell word sneaks with the exit.

    Meh. Would have been better as a haiku

    Was just a random sentence generator.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (4/17/2012)


    andrew gothard (4/17/2012)


    Sean Lange (4/16/2012)


    hbtkp (4/16/2012)


    i dont know what is cumulative formula.

    but this is how i am getting my final data in report.

    so based on how they calculate , i need to do implement that formula in sql.

    this result is accurate.i need to figure out formula based on that

    Well how do you expect somebody else to help with a formula when you can't explain how to calculate it?

    Let me try to paraphrase in extremely clear english what your questions is.

    The chemical billfold yields to a crazy accent. Behind the fan waits my dress. The infant mortal pilots an ace near a stretch wash. A farewell word sneaks with the exit.

    Meh. Would have been better as a haiku

    Was just a random sentence generator.

    As, apparently, is the OP.

    Poster will not explain

    What problem is, Lynn feels pain

    Like lashing of sleet

    😎 ?

    I'm a DBA.
    I'm not paid to solve problems. I'm paid to prevent them.

  • hbtkp (4/17/2012)


    no this i need to do from udf which returns table

    and i need to put in while or for condition

    You'r the man, hbtkp! I'd buy you a beer if I could. What are you smoking and how can I get it?

    I haven't smile so much on any SQL thread 🙂

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths
  • i m closing this thread

  • hbtkp (4/16/2012)


    it snot running total,if you see it carefully,

    its not just adding values. sometimes its adding 1 ,sometimes it minus 1

    That is what is known as a "running total".

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • hbtkp (4/16/2012)


    this is what i have to figure out ,how they calculate it.

    No problem. Please post the data in the readily consumable format identified in the article in the first link in my signature line below and I'll be very happy to show you how to do that calculation in a very high performance manner.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Actually, never mind. I missed page 2 and now I see the OP closed the thread.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

Viewing 11 posts - 76 through 85 (of 85 total)

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