WHat is the Optimal Table design to store HTML - Help

  • I need to store HTML in 2 fields: logBody and logRawHTML

    I originally set those fields as varchar but HTML would get truncated in weird spots. When I've changed it to NVARCHAR everything seemed to work fine Now I am dealing with an issue when text is slightly bigger than previously tested... :w00t:

    What would be an ideal soolution to this without changing too many things around - separate tables etc.

    Please help.

    Many thanks!!!

    CREATE TABLE [LogTransaction] (

    [logid] [int] IDENTITY (1, 1) NOT NULL ,

    [logTemplateid] [int] NULL ,

    [logTitle] [varchar] (180) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logBody] [nvarchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logDescription] [varchar] (400) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logWhy] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logWhen] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logAction] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logImpact] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logSendDate] [smalldatetime] NULL ,

    [logReminder] [bit] NOT NULL ,

    [logReminderDate] [smalldatetime] NULL ,

    [logEmailTo] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logOwner] [nvarchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logApprover] [nvarchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logStatus] [int] NOT NULL ,

    [logRawHTML] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logReminderRawHTML] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logErrors] [varchar] (300) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

    [logSubmitDate] [smalldatetime] NULL CONSTRAINT [DF_LogTransaction_logSubmitDate] DEFAULT (getdate()),

    [logApprovedDate] [smalldatetime] NULL ,

    [logDepartmentID] [int] NULL ,

    [logSendStatus] [int] NULL ,

    [logReminderStatus] [int] NULL

    ) ON [PRIMARY]

    GO

  • nvarchar can go up to 4,000 characters, you could first try and extend the field length to see if that gives you enough space.

    Facts are stubborn things, but statistics are more pliable - Mark Twain
    Carolyn
    SQLServerSpecialists[/url]

  • Can I have 2 fields of type of NVARCHAR with size 4000 plus others? 2 fields would be 8,000 plus other so it will exceed row size, right? am I getting this right?

Viewing 3 posts - 1 through 2 (of 2 total)

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