Querying the max row length

  • When was that?? I never saw it work like I want it to ;)... like the old one.

  • What exactly do you mean by Max Length of the row ?

  • Hey,

    finally somebody coming back to the original topic of this post.

    As you can find somewhere in the beginning of this post, I was searching for the record in a table with the max length in bytes. This means adding up the actual field length of each column.

    My final script would then provide the defined max length of a record and the longest actual record for all tables. Because it goes through all records in all tables in can take quite long. If you need to check just one table, it shouldn't be too difficult to change the script.

    [font="Verdana"]Markus Bohse[/font]

  • Ninja's_RGR'us (10/2/2007)


    When was that?? I never saw it work like I want it to ;)... like the old one.

    Actually, all that stuff worked... for about the first two days...

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

  • Mahesh Gupta (10/2/2007)


    What exactly do you mean by Max Length of the row ?

    The maximum length of a row can be 8060 bytes. In this case, some of the folks are referring to "Max Length" as the total number of actual bytes used for each row.

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

  • I think he mean TOTAL length for all 8 nvarchar columns.

    SELECT TOP 1 WITH TIES PkCol, cl

    FROM (

    SELECT PkCol, DATALENGTH(Col1) + DATALENGTH(Col2) + DATALENGTH(Col3) + DATALENGTH(Col4) + DATALENGTH(Col5) + DATALENGTH(Col6) + DATALENGTH(Col7) + DATALENGTH(Col7) AS cl

    FROM Table1

    ) ORDER BY cl DESC


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 6 posts - 31 through 35 (of 35 total)

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