Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2004
    Location
    Far away from heaven
    Posts
    194

    Unanswered: What does this mean

    Hi folks, I added a column into one of my table and got this error upon saving changes:

    Warning: The table 'MY_TABLE' has been created but its maximum row size (8777) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds

    What's the max limit of columns within the table? And how i would get error upon inserting or updating a row for that table?


    Howdy!

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    In sql rows are stored in pages of 8K in which a maximum of 8060 bytes of data can be stored (not including text and image datatypes). In your case, the sum of the bytes for all of the columns exceed that maximum. When updating or inserting a row which exceeds this maximum, the command will fail and rollbacked.

    fe:
    use monkey
    go

    create table mytable (myrow1 varchar(5000))
    go

    alter table mytable add myrow2 varchar(5000)
    go

    insert into mytable (myrow1) values ('aa')

    declare @i as integer
    , @r1 as varchar(5000)
    , @r2 as varchar(5000)
    set @r1 = ''
    set @i = 500
    while (@i > 0)
    begin
    set @r1 = @r1 + '0123456789'
    set @i = @i - 1
    end

    insert into mytable (myrow1) values (@r1)

    insert into mytable (myrow1, myrow2) values (@r1, @r1)
    select * from mytable



    drop table mytable
    go

  3. #3
    Join Date
    Jun 2004
    Location
    Far away from heaven
    Posts
    194
    so, how do i square this; do i need to split the table into small(more joining )

    and what's the max limit of columns within a table.


    Howdy!

  4. #4
    Join Date
    Feb 2004
    Posts
    492
    I think the limit is 1024 columns. If changing the size of columns is not an option, I see no alternative other than splitting the table.

  5. #5
    Join Date
    Jun 2004
    Location
    Far away from heaven
    Posts
    194
    Thanx, Kaiowas!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •