creating table error?

  • Hai Friends,

    Im creating one table for web application these is my table structure.

    after wrote the code ll show one waring message

    create table onward_journey

    (

    onward_journey int identity,

    departuredate datetime,

    from_location varchar(100),

    to_location varchar(100),

    metro nvarchar(1100),

    trans_all nvarchar (1100),

    mode_of_travel nvarchar(1100),

    seat_type nvarchar(1100),

    no_of_days int,

    other_details varchar(100),

    status_id int foreign key references status(status_id)

    )

    Warning: The table 'onward_journey' has been created but its maximum row size (9156) 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 8060 bytes.

    do the need full what can i do now?

  • Are the NVARCHAR columns necessary?

    ---------------------------------------------------------

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn

  • ya i need it:)

  • You can

    1) decrease the width of your NVARCHAR columns from 1100 to 900 (that should keep you within the limit)

    2) Normalise your table to have fewer columns in the table.

    By the way, this is just a warning so everything should still work but you may have issues for the rows that do full up the columns. If you know you're not going to have too many rows of that size then you may be able to get away with it without noticing any performance degradation.

    ---------------------------------------------------------

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn

  • create table dbo.Location (

    id int identity,

    Name varchar(100),

    constraint PK_Location PRIMARY KEY (id),

    constraint UK_Location unique (Name )

    )

    create table dbo.TravelAttribute(

    id int identity,

    Name nvarchar(1100),

    constraint PK_TravelAttribute PRIMARY KEY (id),

    constraint UK_TravelAttribute unique (Name )

    )

    create table onward_journey

    (

    onward_journey int identity,

    departuredate datetime,

    from_location_id int foreign key references Location(id),

    to_location_id int foreign key references Location(id),

    metro_id int foreign key references TravelAttribute(id),

    trans_all_id int foreign key references TravelAttribute(id),

    mode_of_travel_id int foreign key references TravelAttribute(id),

    seat_type_id int foreign key references TravelAttribute(id),

    no_of_days int,

    other_details varchar(100),

    status_id int foreign key references status(status_id)

    )

    create view onward_journey_details

    AS

    select J. onward_journey, J.departuredate, FL.name from_location, TL.name to_location,

    .....

    FROM onward_journey J

    INNER JOIN dbo.Location FL ON FL.id = J.from_location_id

    INNER JOIN dbo.Location TL ON TL.id = J.to_location_id

    INNER JOIN dbo.TravelAttribute M ON M.id = J.metro_id

    ... and so on

    _____________
    Code for TallyGenerator

  • mode_of_travel nvarchar(1100),

    seat_type nvarchar(1100),

    What kinds of seats or travel options require 1000 unicode characters to explain? I'd think of seat type as 'economy', 'premium', 'business', etc, not half a novel.

    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 (4/30/2013)


    What kinds of seats or travel options require 1000 unicode characters to explain? I'd think of seat type as 'economy', 'premium', 'business', etc, not half a novel.

    Comma separated names in all supported languages?:hehe:

    _____________
    Code for TallyGenerator

  • Sergiy (4/30/2013)


    GilaMonster (4/30/2013)


    What kinds of seats or travel options require 1000 unicode characters to explain? I'd think of seat type as 'economy', 'premium', 'business', etc, not half a novel.

    Comma separated names in all supported languages?:hehe:

    *shudder*

    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
  • Lol... All the more reason to normalise the table.

    ---------------------------------------------------------

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn

  • The table is pretty well normalised, though we don't have a candidate key, can assume that's what the identity is supposed to be. There are no repeating groups (unless there is comma-delimited stuff in those 1000 character columns), no partial key dependencies, while there could be some intra-data dependencies they're not obvious ones and there's no intra-key dependencies. Depending on the intra-data dependencies, that's either in 2nd or Boyce-Codd normal form as it stands, providing of course that there aren't comma-delimited lists in some columns.

    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

Viewing 10 posts - 1 through 9 (of 9 total)

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