Usage of "Tally Table"

  • I hope you got the below output. Right ?

    11

    12

    13

    14

    15

    16

    17

    18

    19

    110

    21

    22

    23

    24

    25

    26

    27

    28

    29

    210

    31

    32

    33

    34

    35

    36

    37

    38

    39

    310

    41

    42

    43

    44

    45

    46

    47

    48

    49

    410

    51

    52

    53

    54

    55

    56

    57

    58

    59

    510

    61

    62

    63

    64

    65

    66

    67

    68

    69

    610

    71

    72

    73

    74

    75

    76

    77

    78

    79

    710

    81

    82

    83

    84

    85

    86

    87

    88

    89

    810

    91

    92

    93

    94

    95

    96

    97

    98

    99

    910

    101

    102

    103

    104

    105

    106

    107

    108

    109

    1010

    karthik

  • What's your point, Karthik? Chris knows exactly what the output will be for any pair of numbers entered into his query...

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Chris,

    My point is, just i wanted to confirm which query is performing good.

    karthik

  • Chris knows exactly what the output will be for any pair of numbers entered into his query...

    Chris morris,

    I do know he knows exactly what the output will be. I am not offending anybody here.

    I just wanted to confirm the output.Because i got different result set for each method.

    Chris, Karthik's corrected code has the same functionality but was it by design?:P

    what are you trying to show?

    karthik

  • Never mind...

    --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)

Viewing 5 posts - 16 through 20 (of 20 total)

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