Table MAX Rowsize

  • Hi

    I have a table I have dropped 37 columns that are unused. Then added two columns, one of type int and the other NVARCHAR(16). SQL Server does not complain that the max row size might go above 8060 bytes. But then I run some data in, which has been retrieved from 4 columns which are dropped, these are id's from external data that is imported. Then I get the following error:

    Msg 511, Level 16, State 1, Line 1

    Cannot create a row of size 8072 which is greater than the allowable maximum of 8060.

    The statement has been terminated.

    Why is this?

    And what can I do?

    The database was upgraded from SQL Server 2000 to SQL Server 2005.

    Thanks in advance

    Graham Harris

  • OK figured out what was going wrong. Found this article on MSDN

    http://blogs.msdn.com/msdnts/archive/2006/12/01/row-size-limitation-in-sql-2000-and-2005.aspx

    and I realized that there are a lot of fields that are of NCHAR(n) rather than NVARCHAR(n).

    Graham Harris

  • OK Crated a script that converted the NCHAR fields to NVARCHAR fields BUT it fell over when the data was reinserted back into the table. As I had to copy the data out, drop the NCHAR field and recreate the field as NVARCHAR. As I get MAX Row size exceeded. Now when I reinsert the data I get MAX row size exceeded.

    Now either I am missing something, but according to MSDN SQL Server 2005 can cope with this by splitting the row across data pages. Also looking at the script I get errors with indexes being too large!!!

    Now the version I am testing this script on is SQL SERVER 2005 developers edition (I am running it on my Windows XP laptop). Is there some kind of limitation imposed on this version of SQL Server? Or is something fundamentally with the database!!

    TIA

    Graham Harris

  • gharris_35 (2/9/2009)


    OK Crated a script that converted the NCHAR fields to NVARCHAR fields BUT it fell over when the data was reinserted back into the table. As I had to copy the data out, drop the NCHAR field and recreate the field as NVARCHAR. As I get MAX Row size exceeded. Now when I reinsert the data I get MAX row size exceeded.

    Now either I am missing something, but according to MSDN SQL Server 2005 can cope with this by splitting the row across data pages. Also looking at the script I get errors with indexes being too large!!!

    Now the version I am testing this script on is SQL SERVER 2005 developers edition (I am running it on my Windows XP laptop). Is there some kind of limitation imposed on this version of SQL Server? Or is something fundamentally with the database!!

    TIA

    Graham Harris

    Dev edtn should would 100% like Enterprise Edtn.

    How many columns are there in your table ?

    (post ddl if you can)

    Did you upgrade to SP3 ?

    ( select @@version )

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Forgot to mention that the table contains a variety of data types, int, datetime, bit. Will this prevent SQL Server from wrapping the data up into another page?

    Graham Harris

  • 1. SP3 has been installed

    2. Here is the DDL for the unchanged table:

    CREATE TABLE [dbo].[Lead](

    [Lead_LeadID] [int] NOT NULL,

    [Lead_CreatedBy] [int] NULL,

    [Lead_CreatedDate] [datetime] NULL,

    [Lead_UpdatedBy] [int] NULL,

    [Lead_UpdatedDate] [datetime] NULL,

    [Lead_TimeStamp] [datetime] NULL,

    [Lead_Deleted] [int] NULL,

    [Lead_PrimaryCompanyID] [int] NULL,

    [Lead_PrimaryPersonID] [int] NULL,

    [Lead_CompanyName] [nchar](60) NULL,

    [Lead_CompanyAddress1] [nchar](40) NULL,

    [Lead_CompanyAddress2] [nchar](40) NULL,

    [Lead_CompanyAddress3] [nchar](40) NULL,

    [Lead_CompanyAddress4] [nchar](40) NULL,

    [Lead_CompanyCity] [nchar](30) NULL,

    [Lead_CompanyState] [nchar](30) NULL,

    [Lead_CompanyCountry] [nchar](30) NULL,

    [Lead_CompanyPostCode] [nchar](5) NULL,

    [Lead_PersonFirstName] [nchar](30) NULL,

    [Lead_PersonLastName] [nchar](30) NULL,

    [Lead_PersonPhoneCountryCode] [nchar](5) NULL,

    [Lead_PersonPhoneAreaCode] [nchar](20) NULL,

    [Lead_PersonPhoneNumber] [nchar](20) NULL,

    [Lead_PersonFaxCountryCode] [nchar](5) NULL,

    [Lead_PersonFaxAreaCode] [nchar](20) NULL,

    [Lead_PersonFaxNumber] [nchar](20) NULL,

    [Lead_PersonEMail] [nchar](255) NULL,

    [Lead_PersonSalutation] [nchar](10) NULL,

    [Lead_AssignedUserID] [int] NULL,

    [Lead_Source] [nchar](40) NULL,

    [Lead_Stage] [nchar](40) NULL,

    [Lead_Status] [nchar](40) NULL,

    [Lead_Description] [nchar](40) NULL,

    [Lead_Details] [ntext] NULL,

    [Lead_ChannelID] [int] NULL,

    [Lead_Opened] [datetime] NULL,

    [Lead_Closed] [datetime] NULL,

    [Lead_NotifyTime] [datetime] NULL,

    [Lead_OpportunityID] [int] NULL,

    [Lead_Priority] [nchar](40) NULL,

    [Lead_SecTerr] [int] NULL,

    [Lead_CompanyMatch] [nchar](1) NULL,

    [Lead_DataUpLoadID] [int] NULL,

    [Lead_UpLoadDate] [datetime] NULL,

    [Lead_WorkflowId] [int] NULL,

    [Lead_ReasonNotInterested] [ntext] NULL,

    [lead_MailRestriction] [nvarchar](40) NULL,

    [lead_Type] [nvarchar](40) NULL,

    [lead_WaveItemID] [int] NULL,

    [lead_mainproductinterest] [nvarchar](40) NULL,

    [lead_personmiddlename] [nchar](20) NULL,

    [lead_locations] [nchar](255) NULL,

    [lead_personmobileareacode] [nchar](20) NULL,

    [lead_personmobilenumber] [nchar](20) NULL,

    [lead_personmobilecountrycode] [nchar](5) NULL,

    [lead_persondob] [datetime] NULL,

    [lead_personaddress1] [nchar](40) NULL,

    [lead_personaddress2] [nchar](40) NULL,

    [lead_personaddress3] [nchar](40) NULL,

    [lead_personaddress4] [nchar](40) NULL,

    [lead_personcity] [nchar](30) NULL,

    [lead_personcountry] [nchar](40) NULL,

    [lead_personstate] [nchar](30) NULL,

    [lead_personpostcode] [nchar](10) NULL,

    [lead_subsource] [nchar](45) NULL,

    [lead_personpreferemail] [nchar](1) NULL,

    [lead_personpreferphone] [nchar](1) NULL,

    [lead_personpreferfax] [nchar](1) NULL,

    [lead_personpreferpost] [nchar](1) NULL,

    [lead_personnationality] [nchar](40) NULL,

    [lead_persongender] [nchar](40) NULL,

    [lead_personlanguage] [nchar](40) NULL,

    [lead_personstudentid] [nchar](20) NULL,

    [lead_personprivacypolicy] [nchar](40) NULL,

    [lead_personnotes] [ntext] NULL,

    [lead_personenquirydate] [datetime] NULL,

    [lead_personmailrestriction] [nchar](1) NULL,

    [lead_personpromotions] [nchar](1) NULL,

    [lead_interest] [nchar](40) NULL,

    [lead_fromdataid] [int] NULL,

    [lead_emailerror] [nchar](255) NULL,

    [lead_destination] [nchar](80) NULL,

    [lead_destinationcode] [nchar](20) NULL,

    [lead_course] [nchar](80) NULL,

    [lead_coursecode] [nchar](20) NULL,

    [lead_startdate] [datetime] NULL,

    [lead_numberofweeks] [int] NULL,

    [lead_accom1] [nchar](80) NULL,

    [lead_accom1code] [nchar](20) NULL,

    [lead_accom2] [nchar](80) NULL,

    [lead_accom2code] [nchar](20) NULL,

    [lead_accomlength] [int] NULL,

    [lead_ucps] [nchar](80) NULL,

    [lead_ucpscode] [nchar](20) NULL,

    [lead_internship] [nchar](80) NULL,

    [lead_internshipcode] [nchar](20) NULL,

    [lead_transferservice] [nchar](80) NULL,

    [lead_transferservicecode] [nchar](20) NULL,

    [lead_caxinsurance] [nchar](80) NULL,

    [lead_caxinsurancecode] [nchar](20) NULL,

    [lead_medinsurance] [nchar](80) NULL,

    [lead_medinsurancecode] [nchar](20) NULL,

    [lead_personsmoker] [nchar](10) NULL,

    [lead_personallergy] [nchar](30) NULL,

    [lead_personallergydetails] [ntext] NULL,

    [lead_decisiontimeframe] [nchar](40) NULL,

    [lead_rateddate] [datetime] NULL,

    [lead_rating] [nchar](40) NULL,

    [lead_sourcename] [nchar](20) NULL,

    [lead_fromdataid2] [int] NULL,

    [lead_besttimetocall] [nvarchar](40) NULL,

    [lead_sefromdataid] [int] NULL,

    [lead_onlinepaymentid] [nchar](40) NULL,

    [lead_termsandconditions] [nchar](1) NULL,

    [lead_testnumeric] [numeric](24, 6) NULL,

    [lead_enrolmentfeecode] [nchar](20) NULL,

    [lead_companywebsite] [nchar](1) NULL,

    [lead_mailing] [nchar](1) NULL,

    [lead_schoolinterest] [nvarchar](255) NULL,

    [lead_schoolofinterest] [nvarchar](255) NULL,

    [lead_forwardtorep] [nchar](1) NULL,

    [lead_senttorep] [nchar](1) NULL,

    [lead_forwardtoagent] [int] NULL,

    [lead_roomavailable] [nvarchar](40) NULL,

    [lead_roomdetails] [nchar](200) NULL,

    [lead_confirmedemail] [nchar](1) NULL,

    [lead_url] [nchar](200) NULL,

    [lead_formdataid3] [int] NULL,

    [lead_formname3] [nchar](255) NULL,

    [lead_roomtype] [nvarchar](40) NULL,

    [lead_roomnotes] [ntext] NULL,

    [Lead_CompanyIndustry] [nchar](40) NULL,

    [lead_Sector] [nvarchar](40) NULL,

    [lead_addressuszipplusfour] [nchar](4) NULL

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

    GO

    TIA

    Graham Harris

  • Can you post the DDL ?


    * Noel

  • gharris_35 (2/9/2009)


    1. SP3 has been installed

    2. Here is the DDL for the unchanged table:

    CREATE TABLE [dbo].[Lead](

    [Lead_LeadID] [int] NOT NULL,

    [Lead_CreatedBy] [int] NULL,

    [Lead_CreatedDate] [datetime] NULL,

    [Lead_UpdatedBy] [int] NULL,

    [Lead_UpdatedDate] [datetime] NULL,

    [Lead_TimeStamp] [datetime] NULL,

    [Lead_Deleted] [int] NULL,

    [Lead_PrimaryCompanyID] [int] NULL,

    [Lead_PrimaryPersonID] [int] NULL,

    [Lead_CompanyName] [nchar](60) NULL,

    [Lead_CompanyAddress1] [nchar](40) NULL,

    [Lead_CompanyAddress2] [nchar](40) NULL,

    [Lead_CompanyAddress3] [nchar](40) NULL,

    [Lead_CompanyAddress4] [nchar](40) NULL,

    [Lead_CompanyCity] [nchar](30) NULL,

    [Lead_CompanyState] [nchar](30) NULL,

    [Lead_CompanyCountry] [nchar](30) NULL,

    [Lead_CompanyPostCode] [nchar](5) NULL,

    [Lead_PersonFirstName] [nchar](30) NULL,

    [Lead_PersonLastName] [nchar](30) NULL,

    [Lead_PersonPhoneCountryCode] [nchar](5) NULL,

    [Lead_PersonPhoneAreaCode] [nchar](20) NULL,

    [Lead_PersonPhoneNumber] [nchar](20) NULL,

    [Lead_PersonFaxCountryCode] [nchar](5) NULL,

    [Lead_PersonFaxAreaCode] [nchar](20) NULL,

    [Lead_PersonFaxNumber] [nchar](20) NULL,

    [Lead_PersonEMail] [nchar](255) NULL,

    [Lead_PersonSalutation] [nchar](10) NULL,

    [Lead_AssignedUserID] [int] NULL,

    [Lead_Source] [nchar](40) NULL,

    [Lead_Stage] [nchar](40) NULL,

    [Lead_Status] [nchar](40) NULL,

    [Lead_Description] [nchar](40) NULL,

    [Lead_Details] [ntext] NULL,

    [Lead_ChannelID] [int] NULL,

    [Lead_Opened] [datetime] NULL,

    [Lead_Closed] [datetime] NULL,

    [Lead_NotifyTime] [datetime] NULL,

    [Lead_OpportunityID] [int] NULL,

    [Lead_Priority] [nchar](40) NULL,

    [Lead_SecTerr] [int] NULL,

    [Lead_CompanyMatch] [nchar](1) NULL,

    [Lead_DataUpLoadID] [int] NULL,

    [Lead_UpLoadDate] [datetime] NULL,

    [Lead_WorkflowId] [int] NULL,

    [Lead_ReasonNotInterested] [ntext] NULL,

    [lead_MailRestriction] [nvarchar](40) NULL,

    [lead_Type] [nvarchar](40) NULL,

    [lead_WaveItemID] [int] NULL,

    [lead_mainproductinterest] [nvarchar](40) NULL,

    [lead_personmiddlename] [nchar](20) NULL,

    [lead_locations] [nchar](255) NULL,

    [lead_personmobileareacode] [nchar](20) NULL,

    [lead_personmobilenumber] [nchar](20) NULL,

    [lead_personmobilecountrycode] [nchar](5) NULL,

    [lead_persondob] [datetime] NULL,

    [lead_personaddress1] [nchar](40) NULL,

    [lead_personaddress2] [nchar](40) NULL,

    [lead_personaddress3] [nchar](40) NULL,

    [lead_personaddress4] [nchar](40) NULL,

    [lead_personcity] [nchar](30) NULL,

    [lead_personcountry] [nchar](40) NULL,

    [lead_personstate] [nchar](30) NULL,

    [lead_personpostcode] [nchar](10) NULL,

    [lead_subsource] [nchar](45) NULL,

    [lead_personpreferemail] [nchar](1) NULL,

    [lead_personpreferphone] [nchar](1) NULL,

    [lead_personpreferfax] [nchar](1) NULL,

    [lead_personpreferpost] [nchar](1) NULL,

    [lead_personnationality] [nchar](40) NULL,

    [lead_persongender] [nchar](40) NULL,

    [lead_personlanguage] [nchar](40) NULL,

    [lead_personstudentid] [nchar](20) NULL,

    [lead_personprivacypolicy] [nchar](40) NULL,

    [lead_personnotes] [ntext] NULL,

    [lead_personenquirydate] [datetime] NULL,

    [lead_personmailrestriction] [nchar](1) NULL,

    [lead_personpromotions] [nchar](1) NULL,

    [lead_interest] [nchar](40) NULL,

    [lead_fromdataid] [int] NULL,

    [lead_emailerror] [nchar](255) NULL,

    [lead_destination] [nchar](80) NULL,

    [lead_destinationcode] [nchar](20) NULL,

    [lead_course] [nchar](80) NULL,

    [lead_coursecode] [nchar](20) NULL,

    [lead_startdate] [datetime] NULL,

    [lead_numberofweeks] [int] NULL,

    [lead_accom1] [nchar](80) NULL,

    [lead_accom1code] [nchar](20) NULL,

    [lead_accom2] [nchar](80) NULL,

    [lead_accom2code] [nchar](20) NULL,

    [lead_accomlength] [int] NULL,

    [lead_ucps] [nchar](80) NULL,

    [lead_ucpscode] [nchar](20) NULL,

    [lead_internship] [nchar](80) NULL,

    [lead_internshipcode] [nchar](20) NULL,

    [lead_transferservice] [nchar](80) NULL,

    [lead_transferservicecode] [nchar](20) NULL,

    [lead_caxinsurance] [nchar](80) NULL,

    [lead_caxinsurancecode] [nchar](20) NULL,

    [lead_medinsurance] [nchar](80) NULL,

    [lead_medinsurancecode] [nchar](20) NULL,

    [lead_personsmoker] [nchar](10) NULL,

    [lead_personallergy] [nchar](30) NULL,

    [lead_personallergydetails] [ntext] NULL,

    [lead_decisiontimeframe] [nchar](40) NULL,

    [lead_rateddate] [datetime] NULL,

    [lead_rating] [nchar](40) NULL,

    [lead_sourcename] [nchar](20) NULL,

    [lead_fromdataid2] [int] NULL,

    [lead_besttimetocall] [nvarchar](40) NULL,

    [lead_sefromdataid] [int] NULL,

    [lead_onlinepaymentid] [nchar](40) NULL,

    [lead_termsandconditions] [nchar](1) NULL,

    [lead_testnumeric] [numeric](24, 6) NULL,

    [lead_enrolmentfeecode] [nchar](20) NULL,

    [lead_companywebsite] [nchar](1) NULL,

    [lead_mailing] [nchar](1) NULL,

    [lead_schoolinterest] [nvarchar](255) NULL,

    [lead_schoolofinterest] [nvarchar](255) NULL,

    [lead_forwardtorep] [nchar](1) NULL,

    [lead_senttorep] [nchar](1) NULL,

    [lead_forwardtoagent] [int] NULL,

    [lead_roomavailable] [nvarchar](40) NULL,

    [lead_roomdetails] [nchar](200) NULL,

    [lead_confirmedemail] [nchar](1) NULL,

    [lead_url] [nchar](200) NULL,

    [lead_formdataid3] [int] NULL,

    [lead_formname3] [nchar](255) NULL,

    [lead_roomtype] [nvarchar](40) NULL,

    [lead_roomnotes] [ntext] NULL,

    [Lead_CompanyIndustry] [nchar](40) NULL,

    [lead_Sector] [nvarchar](40) NULL,

    [lead_addressuszipplusfour] [nchar](4) NULL

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

    GO

    TIA

    Graham Harris

    When you create such table you will see a warning message like this:

    "Warning: The table "Lead" has been created, but its maximum row size exceeds the allowed maximum of 8060 bytes. INSERT or UPDATE to this table will fail if the resulting row exceeds the size limit."

    Which means that the addition of all the column sizes surpasses that 8060 limit.

    Do you really need nchar instead of varchar ?


    * Noel

  • In addition it looks like you need normalization (a lot) on that table.


    * Noel

  • I think I may have found the error. Will keep you posted......

    Graham Harris

  • What this script is trying to do is to drop fields that the client does not use. for example LEAD_COMPANYNAME, as the Database is a CRM system (Sage CRM to be precise). I successfully drop the unused fields and then go through and convert the NCHAR fields to NVARCHAR fields the result being:

    CREATE TABLE [dbo].[Lead](

    [Lead_LeadID] [int] NOT NULL,

    [Lead_CreatedBy] [int] NULL,

    [Lead_CreatedDate] [datetime] NULL,

    [Lead_UpdatedBy] [int] NULL,

    [Lead_UpdatedDate] [datetime] NULL,

    [Lead_TimeStamp] [datetime] NULL,

    [Lead_Deleted] [int] NULL,

    [Lead_PrimaryCompanyID] [int] NULL,

    [Lead_PrimaryPersonID] [int] NULL,

    [Lead_AssignedUserID] [int] NULL,

    [Lead_Details] [ntext] NULL,

    [Lead_ChannelID] [int] NULL,

    [Lead_Opened] [datetime] NULL,

    [Lead_Closed] [datetime] NULL,

    [Lead_NotifyTime] [datetime] NULL,

    [Lead_OpportunityID] [int] NULL,

    [Lead_SecTerr] [int] NULL,

    [Lead_DataUpLoadID] [int] NULL,

    [Lead_UpLoadDate] [datetime] NULL,

    [Lead_WorkflowId] [int] NULL,

    [Lead_ReasonNotInterested] [ntext] NULL,

    [lead_MailRestriction] [nvarchar](40) NULL,

    [lead_Type] [nvarchar](40) NULL,

    [lead_WaveItemID] [int] NULL,

    [lead_mainproductinterest] [nvarchar](40) NULL,

    [lead_persondob] [datetime] NULL,

    [lead_personnotes] [ntext] NULL,

    [lead_personenquirydate] [datetime] NULL,

    [lead_numberofweeks] [int] NULL,

    [lead_personallergydetails] [ntext] NULL,

    [lead_rateddate] [datetime] NULL,

    [lead_besttimetocall] [nvarchar](40) NULL,

    [lead_sefromdataid] [int] NULL,

    [lead_schoolofinterest] [nvarchar](255) NULL,

    [lead_forwardtoagent] [int] NULL,

    [lead_roomtype] [nvarchar](40) NULL,

    [lead_roomnotes] [ntext] NULL,

    [Lead_PersonFirstName] [nvarchar](60) NULL,

    [Lead_PersonLastName] [nvarchar](60) NULL,

    [Lead_PersonPhoneCountryCode] [nvarchar](10) NULL,

    [Lead_PersonPhoneAreaCode] [nvarchar](40) NULL,

    [Lead_PersonPhoneNumber] [nvarchar](40) NULL,

    [Lead_PersonFaxCountryCode] [nvarchar](10) NULL,

    [Lead_PersonFaxAreaCode] [nvarchar](40) NULL,

    [Lead_PersonFaxNumber] [nvarchar](40) NULL,

    [Lead_PersonEMail] [nvarchar](510) NULL,

    [Lead_PersonSalutation] [nvarchar](20) NULL,

    [Lead_Source] [nvarchar](80) NULL,

    [Lead_Stage] [nvarchar](80) NULL,

    [Lead_Status] [nvarchar](80) NULL,

    [Lead_Description] [nvarchar](80) NULL,

    [Lead_Priority] [nvarchar](80) NULL,

    [lead_personmiddlename] [nvarchar](40) NULL,

    [lead_locations] [nvarchar](510) NULL,

    [lead_personmobileareacode] [nvarchar](40) NULL,

    [lead_personmobilenumber] [nvarchar](40) NULL,

    [lead_personmobilecountrycode] [nvarchar](10) NULL,

    [lead_personaddress1] [nvarchar](80) NULL,

    [lead_personaddress2] [nvarchar](80) NULL,

    [lead_personaddress3] [nvarchar](80) NULL,

    [lead_personaddress4] [nvarchar](80) NULL,

    [lead_personcity] [nvarchar](60) NULL,

    [lead_personcountry] [nvarchar](80) NULL,

    [lead_personstate] [nvarchar](60) NULL,

    [lead_personpostcode] [nvarchar](20) NULL,

    [lead_subsource] [nvarchar](90) NULL,

    [lead_personpreferemail] [nvarchar](2) NULL,

    [lead_personpreferphone] [nvarchar](2) NULL,

    [lead_personpreferfax] [nvarchar](2) NULL,

    [lead_personpreferpost] [nvarchar](2) NULL,

    [lead_personnationality] [nvarchar](80) NULL,

    [lead_persongender] [nvarchar](80) NULL,

    [lead_personlanguage] [nvarchar](80) NULL,

    [lead_personstudentid] [nvarchar](40) NULL,

    [lead_personprivacypolicy] [nvarchar](80) NULL,

    [lead_personmailrestriction] [nvarchar](2) NULL,

    [lead_personpromotions] [nvarchar](2) NULL,

    [lead_interest] [nvarchar](80) NULL,

    [lead_emailerror] [nvarchar](510) NULL,

    [lead_course] [nvarchar](160) NULL,

    [lead_personsmoker] [nvarchar](20) NULL,

    [lead_personallergy] [nvarchar](60) NULL,

    [lead_decisiontimeframe] [nvarchar](80) NULL,

    [lead_rating] [nvarchar](80) NULL,

    [lead_sourcename] [nvarchar](40) NULL,

    [lead_onlinepaymentid] [nvarchar](80) NULL,

    [lead_termsandconditions] [nvarchar](2) NULL,

    [lead_mailing] [nvarchar](2) NULL,

    [lead_forwardtorep] [nvarchar](2) NULL,

    [lead_senttorep] [nvarchar](2) NULL,

    [lead_confirmedemail] [nvarchar](2) NULL,

    [lead_url] [nvarchar](400) NULL,

    [lead_formname] [nvarchar](16) NULL,

    [lead_formid] [int] NULL

    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

    In total 37 fields are dropped.

    Graham Harris

  • convert the NCHAR fields to NVARCHAR

    That is only going to "hide" the problem

    Do you really need NVARCHAR instead of VARCHAR ?


    * Noel

  • If you run:

    select sum( character_octet_length)

    from information_schema.columns

    where table_name ='LEAD'

    and data_type not in('ntext','text','image' )

    and character_maximum_length is not null

    the maximum size of the "CHARACTER" columns along is : 9284

    You must change those that you can to VARCHAR it will reduce the width by 2

    You should also consider removing the columns not needed

    You should probably normalize the design a bit.


    * Noel

  • I cannot change the type from NVARCHAR to VARCHAR as the company that is using this database require the NVARCHAR datatype as they deal with clients in, for example, China.

    Graham Harris

  • noeld (2/9/2009)


    You must change those that you can to VARCHAR it will reduce the width by 2

    Unable to do so as the system needs to support multibyte character strings.

    You should also consider removing the columns not needed

    There are probably more columns that can be removed.

    You should probably normalize the design a bit.

    I am actually not responsible for the "design" as this is part of a CRM system therefore I do believe data mining was envisaged. Also this system is from a third party so normalization is not possible. I.e. I could break the system by normalizing the data.

    The other thing that I forgot to mention was that the database was migrated from SQL Server 2000.

    Graham Harris

Viewing 15 posts - 1 through 15 (of 15 total)

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