Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default SQL error

    Does anyone can tell me what is wrong with my SQL server?

    My database field size is 3000 with nvarchar.

    I got an error

    Microsoft]{ODBC SQL server Driver} [SQL server]
    Cannot create a row of size 8087 which is greater than the allowable max of
    8060.
    [Microsoft]{SQL Server} The statement has been terminated.

    Thanks for your help.

    Lin Ma


    Lin Ma Guest

  2. Similar Questions and Discussions

    1. Error Message "A drawing error ocurrred which is probably due to an out-of-memory condition. Try qu
      I am running Acrobat Reader 5.0 on a Mac Powerbook running OS 9.2 and keep getting "A drawing error occurred which is probably due to an out of...
    2. Error 403 Failed to read heders Error for long-runningCFMAIL and CFINDEX command
      I have two different pages with long-running scripts on which I am recieving the following error: Error - 403 Failed to read headers to server:...
    3. Error Creating Control: Parser Error DocHeader does not have a property named 'cc3:MyItems'
      I am having problems getting this webcontrol working properly. Everything else works fine except having items. So here is the low-down on the...
    4. Unexpected error. A trappable error (C0000005) occurred in an external object.
      Hi Elvin, After doing some reseaarch on this problem, I found there is a lot of issues which may cause the problem, for example, incorrect access...
    5. An error occurred while try to load the string resources (GetModuleHandle failed with error -2147023888)
      Hello, on one of our customers servers we get following error on first ASPX-page: An error occurred while try to load the string resources...
  3. #2

    Default Re: SQL error

    You have too many columns, or columns that are too large, aside from this
    one "field" which has a size of 3000. You can only put 8060 bytes in a row,
    so if your total column defined sizes are greater than that, you will get a
    warning (not an error!) when creating the table, and inserts that fully
    populate all of the defined size will generate an error. Can you show your
    CREATE TABLE statement? Also, how exactly are you generating this error?





    "Lin Ma" <a@a.com> wrote in message
    news:#NZbhVJeDHA.2428@TK2MSFTNGP09.phx.gbl...
    > Does anyone can tell me what is wrong with my SQL server?
    >
    > My database field size is 3000 with nvarchar.
    >
    > I got an error
    >
    > Microsoft]{ODBC SQL server Driver} [SQL server]
    > Cannot create a row of size 8087 which is greater than the allowable max
    of
    > 8060.
    > [Microsoft]{SQL Server} The statement has been terminated.
    >
    > Thanks for your help.
    >
    > Lin Ma
    >
    >

    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: SQL error

    Aaron,

    Thanks. The information I inset into the field is too large.

    But I limited to 2500 characters. I think the field size is 3000 will be OK.

    Does field size = 3000 means can hold 3000 characters?

    Finally, I change the field type to TEXT and resolved the problem.

    Am I doing correct?

    Thanks,

    Lin Ma





    "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    news:eFAx8bJeDHA.2300@TK2MSFTNGP10.phx.gbl...
    > You have too many columns, or columns that are too large, aside from this
    > one "field" which has a size of 3000. You can only put 8060 bytes in a
    row,
    > so if your total column defined sizes are greater than that, you will get
    a
    > warning (not an error!) when creating the table, and inserts that fully
    > populate all of the defined size will generate an error. Can you show
    your
    > CREATE TABLE statement? Also, how exactly are you generating this error?
    >
    >
    >
    >
    >
    > "Lin Ma" <a@a.com> wrote in message
    > news:#NZbhVJeDHA.2428@TK2MSFTNGP09.phx.gbl...
    > > Does anyone can tell me what is wrong with my SQL server?
    > >
    > > My database field size is 3000 with nvarchar.
    > >
    > > I got an error
    > >
    > > Microsoft]{ODBC SQL server Driver} [SQL server]
    > > Cannot create a row of size 8087 which is greater than the allowable max
    > of
    > > 8060.
    > > [Microsoft]{SQL Server} The statement has been terminated.
    > >
    > > Thanks for your help.
    > >
    > > Lin Ma
    > >
    > >
    >
    >

    Lin Ma Guest

  5. #4

    Default Re: SQL error

    > Does field size = 3000 means can hold 3000 characters?

    Yes. However, if your INSERT statement also inserts into your other
    columns, and you go over 8060 bytes total (hint: it is not solely because of
    *this* column!), you'll get the error.
    > Finally, I change the field type to TEXT and resolved the problem.
    >
    > Am I doing correct?
    In my opinion, no. Storing a maximum of 3,000 bytes in a TEXT column is
    grossly inefficient. Once again, can you show your CREATE TABLE statement?
    There are likely other ways you can get below the 8,060 byte threshold.


    Aaron Bertrand - MVP Guest

  6. #5

    Default Re: SQL error

    Aaron,

    Here is my long table. All the text field used to be the nvarchar 3000
    field.

    -------------- start table -------------

    if exists (select * from dbo.sysobjects where id =
    object_id(N'[dbo].[FK_CIA_Favorite_CIA]') and OBJECTPROPERTY(id,
    N'IsForeignKey') = 1)
    ALTER TABLE [dbo].[CIA_Favorite] DROP CONSTRAINT FK_CIA_Favorite_CIA
    GO

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CIA]')
    and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[CIA]
    GO

    CREATE TABLE [dbo].[CIA] (
    [CIANum] [int] IDENTITY (1, 1) NOT NULL ,
    [CIAStatus] [int] NULL ,
    [CIAOriginator] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    [CIAOriginatorID] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [OrgDate] [smalldatetime] NULL ,
    [SuntronSite] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CIAType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CIADepartment] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CIASource] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CIAResponse] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CIAProduct] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CIASubProduct] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CIAProblem] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [AuditNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [AuditFindingNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [AuditStandard] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [AuditSectionNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [AuditDocNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    [AuditDocSectionNumber] [nvarchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [AssyNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [AssyRev] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [PartNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [PartRev] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [PartQuantity] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [SiteNCMRNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    [CustomerName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CustomerRep] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CustomerPhone] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CustomerEmail] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CustomerCARNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [CustomerNCMRNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [PONumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [SupplierName] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [SupplierRep] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [SupplierPhone] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [SupplierEmail] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [ManageReviewDate] [smalldatetime] NULL ,
    [CoordinatorPersonID] [nvarchar] (3000) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [CoordinationDate] [datetime] NULL ,
    [CoordinationResult] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [CoordinationComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [CIAClassification] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [InvestigationPersonID] [nvarchar] (3000) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvestigationDate] [smalldatetime] NULL ,
    [CIASimilarProcessYN] [bit] NULL ,
    [CIASimilarProcess] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [InvRootCauseToolsUsed] [nvarchar] (200) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvRootCause] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvContainmentAction] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvActionOption] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvProposedAction] [bit] NULL ,
    [InvComments] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvActionProposedDate] [smalldatetime] NULL ,
    [InvCostEstCalc] [bit] NULL ,
    [InvCostQuantified] [float] NULL ,
    [InvCostUnQuantified] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [InvBenefitEstCalc] [bit] NULL ,
    [InvBenefitQuantified] [float] NULL ,
    [InvBenefitUnQuantified] [nvarchar] (200) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvOpportunityStatement] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    [VerificationPersonIDOld] [nvarchar] (3000) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [CIARejectReason] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvCompleteYN] [bit] NULL ,
    [InvAddressRootCauseYN] [bit] NULL ,
    [InvAdequateContainmentYN] [bit] NULL ,
    [InvActionEffectiveYN] [bit] NULL ,
    [InvCostBenefitAccurateYN] [bit] NULL ,
    [InvActionAtThisTimeYN] [bit] NULL ,
    [InvVerificationAcceptReject] [bit] NULL ,
    [InvVerComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvVerifierPersonID] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [InvVerificationDate] [smalldatetime] NULL ,
    [ProjectLeaderID] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    [ProjectTeamID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    [ActionResult] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [ActionResultComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [ActionEffectivityDate] [smalldatetime] NULL ,
    [ActionActualEstimatedCost] [bit] NULL ,
    [ActionCost] [float] NULL ,
    [ActionCostComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [ActionActualEstimatedBenefit] [bit] NULL ,
    [ActionBenefit] [float] NULL ,
    [ActionBenefitComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [ActionPersonID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [ActionDate] [smalldatetime] NULL ,
    [ActionVerPersonID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [ActionPastDue] [bit] NULL ,
    [ActionPastDueTime] [float] NULL ,
    [ActionVer_ActionPerformedYN] [bit] NULL ,
    [ActionVer_Comment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [ActionVerDate] [smalldatetime] NULL ,
    [ValidationEffYN] [bit] NULL ,
    [Validation_Comment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [ValidatorPersonID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [ValidationBackTo] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [ValidationDate] [smalldatetime] NULL ,
    [ReIssueCIA] [int] NULL ,
    [RejectCIANum] [int] NULL ,
    [ReIssueCIANum] [int] NULL ,
    [CIATimeSpend] [float] NULL ,
    [CIAClosedDate] [smalldatetime] NULL
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO


    ----------------end table -----------------




    "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    news:uqh0UuJeDHA.2304@TK2MSFTNGP11.phx.gbl...
    > > Does field size = 3000 means can hold 3000 characters?
    >
    > Yes. However, if your INSERT statement also inserts into your other
    > columns, and you go over 8060 bytes total (hint: it is not solely because
    of
    > *this* column!), you'll get the error.
    >
    > > Finally, I change the field type to TEXT and resolved the problem.
    > >
    > > Am I doing correct?
    >
    > In my opinion, no. Storing a maximum of 3,000 bytes in a TEXT column is
    > grossly inefficient. Once again, can you show your CREATE TABLE
    statement?
    > There are likely other ways you can get below the 8,060 byte threshold.
    >
    >

    Lin Ma Guest

  7. #6

    Default Re: SQL error

    Yikes... are you sure all of those nvarchar(50) columns require 50
    characters? And the larger ones too? Do they really all have to be
    nvarchar (will CIADepartment, for example, ever really need to support
    foreign alphabets)? Also, could none of this information go in a peripheral
    table?

    The way it is now, you may as well just store this data in flat files. I
    can't imagine having to use this table for anything, and expecting half
    decent performance...




    "Lin Ma" <a@a.com> wrote in message
    news:emLO00JeDHA.1820@TK2MSFTNGP10.phx.gbl...
    > Aaron,
    >
    > Here is my long table. All the text field used to be the nvarchar 3000
    > field.
    >
    > -------------- start table -------------
    >
    > if exists (select * from dbo.sysobjects where id =
    > object_id(N'[dbo].[FK_CIA_Favorite_CIA]') and OBJECTPROPERTY(id,
    > N'IsForeignKey') = 1)
    > ALTER TABLE [dbo].[CIA_Favorite] DROP CONSTRAINT FK_CIA_Favorite_CIA
    > GO
    >
    > if exists (select * from dbo.sysobjects where id =
    object_id(N'[dbo].[CIA]')
    > and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    > drop table [dbo].[CIA]
    > GO
    >
    > CREATE TABLE [dbo].[CIA] (
    > [CIANum] [int] IDENTITY (1, 1) NOT NULL ,
    > [CIAStatus] [int] NULL ,
    > [CIAOriginator] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > [CIAOriginatorID] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [OrgDate] [smalldatetime] NULL ,
    > [SuntronSite] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIAType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIADepartment] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [CIASource] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIAResponse] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIAProduct] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIASubProduct] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [CIAProblem] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [AuditNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [AuditFindingNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [AuditStandard] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [AuditSectionNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [AuditDocNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > [AuditDocSectionNumber] [nvarchar] (50) COLLATE
    > SQL_Latin1_General_CP1_CI_AS NULL ,
    > [AssyNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [AssyRev] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [PartNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [PartRev] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [PartQuantity] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [SiteNCMRNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > [CustomerName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [CustomerRep] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CustomerPhone] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [CustomerEmail] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [CustomerCARNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [CustomerNCMRNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [PONumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [SupplierName] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [SupplierRep] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [SupplierPhone] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [SupplierEmail] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [ManageReviewDate] [smalldatetime] NULL ,
    > [CoordinatorPersonID] [nvarchar] (3000) COLLATE
    > SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CoordinationDate] [datetime] NULL ,
    > [CoordinationResult] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [CoordinationComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIAClassification] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [InvestigationPersonID] [nvarchar] (3000) COLLATE
    > SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvestigationDate] [smalldatetime] NULL ,
    > [CIASimilarProcessYN] [bit] NULL ,
    > [CIASimilarProcess] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [InvRootCauseToolsUsed] [nvarchar] (200) COLLATE
    > SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvRootCause] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvContainmentAction] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvActionOption] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvProposedAction] [bit] NULL ,
    > [InvComments] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvActionProposedDate] [smalldatetime] NULL ,
    > [InvCostEstCalc] [bit] NULL ,
    > [InvCostQuantified] [float] NULL ,
    > [InvCostUnQuantified] [nvarchar] (200) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [InvBenefitEstCalc] [bit] NULL ,
    > [InvBenefitQuantified] [float] NULL ,
    > [InvBenefitUnQuantified] [nvarchar] (200) COLLATE
    > SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvOpportunityStatement] [text] COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > [VerificationPersonIDOld] [nvarchar] (3000) COLLATE
    > SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIARejectReason] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvCompleteYN] [bit] NULL ,
    > [InvAddressRootCauseYN] [bit] NULL ,
    > [InvAdequateContainmentYN] [bit] NULL ,
    > [InvActionEffectiveYN] [bit] NULL ,
    > [InvCostBenefitAccurateYN] [bit] NULL ,
    > [InvActionAtThisTimeYN] [bit] NULL ,
    > [InvVerificationAcceptReject] [bit] NULL ,
    > [InvVerComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvVerifierPersonID] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvVerificationDate] [smalldatetime] NULL ,
    > [ProjectLeaderID] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > [ProjectTeamID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > [ActionResult] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [ActionResultComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ActionEffectivityDate] [smalldatetime] NULL ,
    > [ActionActualEstimatedCost] [bit] NULL ,
    > [ActionCost] [float] NULL ,
    > [ActionCostComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ActionActualEstimatedBenefit] [bit] NULL ,
    > [ActionBenefit] [float] NULL ,
    > [ActionBenefitComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ActionPersonID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [ActionDate] [smalldatetime] NULL ,
    > [ActionVerPersonID] [nvarchar] (3000) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [ActionPastDue] [bit] NULL ,
    > [ActionPastDueTime] [float] NULL ,
    > [ActionVer_ActionPerformedYN] [bit] NULL ,
    > [ActionVer_Comment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ActionVerDate] [smalldatetime] NULL ,
    > [ValidationEffYN] [bit] NULL ,
    > [Validation_Comment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ValidatorPersonID] [nvarchar] (3000) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > NULL ,
    > [ValidationBackTo] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > [ValidationDate] [smalldatetime] NULL ,
    > [ReIssueCIA] [int] NULL ,
    > [RejectCIANum] [int] NULL ,
    > [ReIssueCIANum] [int] NULL ,
    > [CIATimeSpend] [float] NULL ,
    > [CIAClosedDate] [smalldatetime] NULL
    > ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    > GO
    >
    >
    > ----------------end table -----------------
    >
    >
    >
    >
    > "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    > news:uqh0UuJeDHA.2304@TK2MSFTNGP11.phx.gbl...
    > > > Does field size = 3000 means can hold 3000 characters?
    > >
    > > Yes. However, if your INSERT statement also inserts into your other
    > > columns, and you go over 8060 bytes total (hint: it is not solely
    because
    > of
    > > *this* column!), you'll get the error.
    > >
    > > > Finally, I change the field type to TEXT and resolved the problem.
    > > >
    > > > Am I doing correct?
    > >
    > > In my opinion, no. Storing a maximum of 3,000 bytes in a TEXT column is
    > > grossly inefficient. Once again, can you show your CREATE TABLE
    > statement?
    > > There are likely other ways you can get below the 8,060 byte threshold.
    > >
    > >
    >
    >

    Aaron Bertrand - MVP Guest

  8. #7

    Default Re: SQL error

    Thanks Aaron.

    My database admin told me to use nvarchar and said to store more characters.

    I am not good at database design but will make batter next time.

    Do you know any good SQL database design resource link?

    Thanks for the teaching.

    Lin Ma


    "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    news:usZ7P7JeDHA.3428@tk2msftngp13.phx.gbl...
    > Yikes... are you sure all of those nvarchar(50) columns require 50
    > characters? And the larger ones too? Do they really all have to be
    > nvarchar (will CIADepartment, for example, ever really need to support
    > foreign alphabets)? Also, could none of this information go in a
    peripheral
    > table?
    >
    > The way it is now, you may as well just store this data in flat files. I
    > can't imagine having to use this table for anything, and expecting half
    > decent performance...
    >
    >
    >
    >
    > "Lin Ma" <a@a.com> wrote in message
    > news:emLO00JeDHA.1820@TK2MSFTNGP10.phx.gbl...
    > > Aaron,
    > >
    > > Here is my long table. All the text field used to be the nvarchar 3000
    > > field.
    > >
    > > -------------- start table -------------
    > >
    > > if exists (select * from dbo.sysobjects where id =
    > > object_id(N'[dbo].[FK_CIA_Favorite_CIA]') and OBJECTPROPERTY(id,
    > > N'IsForeignKey') = 1)
    > > ALTER TABLE [dbo].[CIA_Favorite] DROP CONSTRAINT FK_CIA_Favorite_CIA
    > > GO
    > >
    > > if exists (select * from dbo.sysobjects where id =
    > object_id(N'[dbo].[CIA]')
    > > and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    > > drop table [dbo].[CIA]
    > > GO
    > >
    > > CREATE TABLE [dbo].[CIA] (
    > > [CIANum] [int] IDENTITY (1, 1) NOT NULL ,
    > > [CIAStatus] [int] NULL ,
    > > [CIAOriginator] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL
    > > ,
    > > [CIAOriginatorID] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [OrgDate] [smalldatetime] NULL ,
    > > [SuntronSite] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [CIAType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [CIADepartment] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [CIASource] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [CIAResponse] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [CIAProduct] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [CIASubProduct] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [CIAProblem] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [AuditNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [AuditFindingNumber] [nvarchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [AuditStandard] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [AuditSectionNumber] [nvarchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [AuditDocNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL
    > > ,
    > > [AuditDocSectionNumber] [nvarchar] (50) COLLATE
    > > SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [AssyNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [AssyRev] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [PartNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [PartRev] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [PartQuantity] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [SiteNCMRNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL
    > > ,
    > > [CustomerName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [CustomerRep] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [CustomerPhone] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [CustomerEmail] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [CustomerCARNumber] [nvarchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [CustomerNCMRNumber] [nvarchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [PONumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [SupplierName] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [SupplierRep] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [SupplierPhone] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [SupplierEmail] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [ManageReviewDate] [smalldatetime] NULL ,
    > > [CoordinatorPersonID] [nvarchar] (3000) COLLATE
    > > SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [CoordinationDate] [datetime] NULL ,
    > > [CoordinationResult] [nvarchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [CoordinationComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [CIAClassification] [nvarchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [InvestigationPersonID] [nvarchar] (3000) COLLATE
    > > SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [InvestigationDate] [smalldatetime] NULL ,
    > > [CIASimilarProcessYN] [bit] NULL ,
    > > [CIASimilarProcess] [nvarchar] (500) COLLATE
    SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [InvRootCauseToolsUsed] [nvarchar] (200) COLLATE
    > > SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [InvRootCause] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [InvContainmentAction] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [InvActionOption] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [InvProposedAction] [bit] NULL ,
    > > [InvComments] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [InvActionProposedDate] [smalldatetime] NULL ,
    > > [InvCostEstCalc] [bit] NULL ,
    > > [InvCostQuantified] [float] NULL ,
    > > [InvCostUnQuantified] [nvarchar] (200) COLLATE
    > SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [InvBenefitEstCalc] [bit] NULL ,
    > > [InvBenefitQuantified] [float] NULL ,
    > > [InvBenefitUnQuantified] [nvarchar] (200) COLLATE
    > > SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [InvOpportunityStatement] [text] COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL
    > > ,
    > > [VerificationPersonIDOld] [nvarchar] (3000) COLLATE
    > > SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [CIARejectReason] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [InvCompleteYN] [bit] NULL ,
    > > [InvAddressRootCauseYN] [bit] NULL ,
    > > [InvAdequateContainmentYN] [bit] NULL ,
    > > [InvActionEffectiveYN] [bit] NULL ,
    > > [InvCostBenefitAccurateYN] [bit] NULL ,
    > > [InvActionAtThisTimeYN] [bit] NULL ,
    > > [InvVerificationAcceptReject] [bit] NULL ,
    > > [InvVerComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [InvVerifierPersonID] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [InvVerificationDate] [smalldatetime] NULL ,
    > > [ProjectLeaderID] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL
    > > ,
    > > [ProjectTeamID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    > NULL
    > > ,
    > > [ActionResult] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [ActionResultComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [ActionEffectivityDate] [smalldatetime] NULL ,
    > > [ActionActualEstimatedCost] [bit] NULL ,
    > > [ActionCost] [float] NULL ,
    > > [ActionCostComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [ActionActualEstimatedBenefit] [bit] NULL ,
    > > [ActionBenefit] [float] NULL ,
    > > [ActionBenefitComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    ,
    > > [ActionPersonID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [ActionDate] [smalldatetime] NULL ,
    > > [ActionVerPersonID] [nvarchar] (3000) COLLATE
    > SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [ActionPastDue] [bit] NULL ,
    > > [ActionPastDueTime] [float] NULL ,
    > > [ActionVer_ActionPerformedYN] [bit] NULL ,
    > > [ActionVer_Comment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [ActionVerDate] [smalldatetime] NULL ,
    > > [ValidationEffYN] [bit] NULL ,
    > > [Validation_Comment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > > [ValidatorPersonID] [nvarchar] (3000) COLLATE
    > SQL_Latin1_General_CP1_CI_AS
    > > NULL ,
    > > [ValidationBackTo] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL
    > ,
    > > [ValidationDate] [smalldatetime] NULL ,
    > > [ReIssueCIA] [int] NULL ,
    > > [RejectCIANum] [int] NULL ,
    > > [ReIssueCIANum] [int] NULL ,
    > > [CIATimeSpend] [float] NULL ,
    > > [CIAClosedDate] [smalldatetime] NULL
    > > ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    > > GO
    > >
    > >
    > > ----------------end table -----------------
    > >
    > >
    > >
    > >
    > > "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    > > news:uqh0UuJeDHA.2304@TK2MSFTNGP11.phx.gbl...
    > > > > Does field size = 3000 means can hold 3000 characters?
    > > >
    > > > Yes. However, if your INSERT statement also inserts into your other
    > > > columns, and you go over 8060 bytes total (hint: it is not solely
    > because
    > > of
    > > > *this* column!), you'll get the error.
    > > >
    > > > > Finally, I change the field type to TEXT and resolved the problem.
    > > > >
    > > > > Am I doing correct?
    > > >
    > > > In my opinion, no. Storing a maximum of 3,000 bytes in a TEXT column
    is
    > > > grossly inefficient. Once again, can you show your CREATE TABLE
    > > statement?
    > > > There are likely other ways you can get below the 8,060 byte
    threshold.
    > > >
    > > >
    > >
    > >
    >
    >

    Lin Ma Guest

  9. #8

    Default Re: SQL error

    > Do you know any good SQL database design resource link?

    [url]http://www.aspfaq.com/2423[/url]


    Aaron Bertrand [MVP] Guest

  10. #9

    Default Re: SQL error

    >Here is my long table. All the text field used to be the nvarchar 3000
    >field.
    If it's really text, you should be storing it as text anyway. Also, I
    don't know the relationships between your data but it would seem that
    normalizing the database would help quite a bit. You have customer,
    supplier and product data all in the same table. Break as much of
    this as makes sense into separate tables and use foreign keys to
    reference them. For a good sample, look at the Northwind sample
    database.

    Also, it looks like you took defaults on many of these field lengths.
    CUSTOMERPHONE is nvarchar(50), phone numbers are 10 digits. Even with
    country code and a calling card you'd be hard pressed to reach more
    tha 20 characters in any phone number.

    Jeff
    >-------------- start table -------------
    >
    >if exists (select * from dbo.sysobjects where id =
    >object_id(N'[dbo].[FK_CIA_Favorite_CIA]') and OBJECTPROPERTY(id,
    >N'IsForeignKey') = 1)
    >ALTER TABLE [dbo].[CIA_Favorite] DROP CONSTRAINT FK_CIA_Favorite_CIA
    >GO
    >
    >if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CIA]')
    >and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    >drop table [dbo].[CIA]
    >GO
    >
    >CREATE TABLE [dbo].[CIA] (
    > [CIANum] [int] IDENTITY (1, 1) NOT NULL ,
    > [CIAStatus] [int] NULL ,
    > [CIAOriginator] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    >,
    > [CIAOriginatorID] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [OrgDate] [smalldatetime] NULL ,
    > [SuntronSite] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIAType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIADepartment] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIASource] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIAResponse] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIAProduct] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIASubProduct] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIAProblem] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [AuditNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [AuditFindingNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [AuditStandard] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [AuditSectionNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [AuditDocNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    >,
    > [AuditDocSectionNumber] [nvarchar] (50) COLLATE
    >SQL_Latin1_General_CP1_CI_AS NULL ,
    > [AssyNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [AssyRev] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [PartNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [PartRev] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [PartQuantity] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [SiteNCMRNumber] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    >,
    > [CustomerName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CustomerRep] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CustomerPhone] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CustomerEmail] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CustomerCARNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [CustomerNCMRNumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [PONumber] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [SupplierName] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [SupplierRep] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [SupplierPhone] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [SupplierEmail] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ManageReviewDate] [smalldatetime] NULL ,
    > [CoordinatorPersonID] [nvarchar] (3000) COLLATE
    >SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CoordinationDate] [datetime] NULL ,
    > [CoordinationResult] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [CoordinationComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIAClassification] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [InvestigationPersonID] [nvarchar] (3000) COLLATE
    >SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvestigationDate] [smalldatetime] NULL ,
    > [CIASimilarProcessYN] [bit] NULL ,
    > [CIASimilarProcess] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [InvRootCauseToolsUsed] [nvarchar] (200) COLLATE
    >SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvRootCause] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvContainmentAction] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvActionOption] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvProposedAction] [bit] NULL ,
    > [InvComments] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvActionProposedDate] [smalldatetime] NULL ,
    > [InvCostEstCalc] [bit] NULL ,
    > [InvCostQuantified] [float] NULL ,
    > [InvCostUnQuantified] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [InvBenefitEstCalc] [bit] NULL ,
    > [InvBenefitQuantified] [float] NULL ,
    > [InvBenefitUnQuantified] [nvarchar] (200) COLLATE
    >SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvOpportunityStatement] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    >,
    > [VerificationPersonIDOld] [nvarchar] (3000) COLLATE
    >SQL_Latin1_General_CP1_CI_AS NULL ,
    > [CIARejectReason] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvCompleteYN] [bit] NULL ,
    > [InvAddressRootCauseYN] [bit] NULL ,
    > [InvAdequateContainmentYN] [bit] NULL ,
    > [InvActionEffectiveYN] [bit] NULL ,
    > [InvCostBenefitAccurateYN] [bit] NULL ,
    > [InvActionAtThisTimeYN] [bit] NULL ,
    > [InvVerificationAcceptReject] [bit] NULL ,
    > [InvVerComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvVerifierPersonID] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [InvVerificationDate] [smalldatetime] NULL ,
    > [ProjectLeaderID] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    >,
    > [ProjectTeamID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    >,
    > [ActionResult] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ActionResultComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ActionEffectivityDate] [smalldatetime] NULL ,
    > [ActionActualEstimatedCost] [bit] NULL ,
    > [ActionCost] [float] NULL ,
    > [ActionCostComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ActionActualEstimatedBenefit] [bit] NULL ,
    > [ActionBenefit] [float] NULL ,
    > [ActionBenefitComment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ActionPersonID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [ActionDate] [smalldatetime] NULL ,
    > [ActionVerPersonID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [ActionPastDue] [bit] NULL ,
    > [ActionPastDueTime] [float] NULL ,
    > [ActionVer_ActionPerformedYN] [bit] NULL ,
    > [ActionVer_Comment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ActionVerDate] [smalldatetime] NULL ,
    > [ValidationEffYN] [bit] NULL ,
    > [Validation_Comment] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ValidatorPersonID] [nvarchar] (3000) COLLATE SQL_Latin1_General_CP1_CI_AS
    >NULL ,
    > [ValidationBackTo] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    > [ValidationDate] [smalldatetime] NULL ,
    > [ReIssueCIA] [int] NULL ,
    > [RejectCIANum] [int] NULL ,
    > [ReIssueCIANum] [int] NULL ,
    > [CIATimeSpend] [float] NULL ,
    > [CIAClosedDate] [smalldatetime] NULL
    >) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    >GO
    >
    >
    >----------------end table -----------------
    >
    >
    >
    >
    >"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    >news:uqh0UuJeDHA.2304@TK2MSFTNGP11.phx.gbl...
    >> > Does field size = 3000 means can hold 3000 characters?
    >>
    >> Yes. However, if your INSERT statement also inserts into your other
    >> columns, and you go over 8060 bytes total (hint: it is not solely because
    >of
    >> *this* column!), you'll get the error.
    >>
    >> > Finally, I change the field type to TEXT and resolved the problem.
    >> >
    >> > Am I doing correct?
    >>
    >> In my opinion, no. Storing a maximum of 3,000 bytes in a TEXT column is
    >> grossly inefficient. Once again, can you show your CREATE TABLE
    >statement?
    >> There are likely other ways you can get below the 8,060 byte threshold.
    >>
    >>
    >
    Jeff Cochran Guest

  11. #10

    Default SQL error


    Please Help!!!
    I am trying to populate a dropdownlist from information in two other
    dropdropdownlists on my web page. Everything else works, but I keep
    getting this error -
    Incorrect syntax near the keyword 'INNER'.

    here is the code I am using in the selected index changed event of the
    2nd dropdownlist

    <code>
    Private Sub ddlModificationType_SelectedIndexChanged(ByVal sender As
    Object, ByVal e As System.EventArgs) Handles
    ddlModificationType.SelectedIndexChanged


    Dim SQLserver As String = "server =
    localhost;uid=sa;password=;database=master"
    Dim conn As SqlConnection
    Dim com As SqlCommand
    Dim sql As String

    sql = "select
    tblStudentModificationList.ModID,ModificationList. ModDesc" & _
    "FROM (ModificationList)INNER JOIN tblStudentModification ON" &
    _
    "ModificationList.ModID = tblStudentModification.ModID" & _
    "WHERE tblStudentModification.ModID =" &
    (ddlStudentName.SelectedIndex) & _
    "AND ModificationList.ModType =" &
    (ddlModificationType.SelectedIndex) & _
    "ORDER BY tblStudentModification.ModID"


    conn = New SqlConnection(SQLserver)
    com = New SqlCommand(sql, conn)

    Dim ds As New DataSet
    Dim mydataadapter As New SqlDataAdapter(sql, conn)

    mydataadapter.Fill(ds)

    ddlModification.DataSource = ds
    ddlModification.DataBind()

    End Sub

    Thanks in advance for any help!!!






    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Dina Womack Guest

  12. #11

    Default Re: SQL error

    I think you need a space:

    FROM (ModificationList)INNER JOIN

    There is no space between the ")" character and the word INNER. You will
    also need a space between ModDesc and the word FROM.

    I suggest you Response.Write(sql) to see what your SQL statement actually
    looks like.

    Cheers
    Ken

    "Dina Womack" <dina_womack@worldnet.att.net> wrote in message
    news:uJ7jFAscEHA.3616@TK2MSFTNGP10.phx.gbl...
    >
    > Please Help!!!
    > I am trying to populate a dropdownlist from information in two other
    > dropdropdownlists on my web page. Everything else works, but I keep
    > getting this error -
    > Incorrect syntax near the keyword 'INNER'.
    >
    > here is the code I am using in the selected index changed event of the
    > 2nd dropdownlist
    >
    > <code>
    > Private Sub ddlModificationType_SelectedIndexChanged(ByVal sender As
    > Object, ByVal e As System.EventArgs) Handles
    > ddlModificationType.SelectedIndexChanged
    >
    >
    > Dim SQLserver As String = "server =
    > localhost;uid=sa;password=;database=master"
    > Dim conn As SqlConnection
    > Dim com As SqlCommand
    > Dim sql As String
    >
    > sql = "select
    > tblStudentModificationList.ModID,ModificationList. ModDesc" & _
    > "FROM (ModificationList)INNER JOIN tblStudentModification ON" &
    > _
    > "ModificationList.ModID = tblStudentModification.ModID" & _
    > "WHERE tblStudentModification.ModID =" &
    > (ddlStudentName.SelectedIndex) & _
    > "AND ModificationList.ModType =" &
    > (ddlModificationType.SelectedIndex) & _
    > "ORDER BY tblStudentModification.ModID"
    >
    >
    > conn = New SqlConnection(SQLserver)
    > com = New SqlCommand(sql, conn)
    >
    > Dim ds As New DataSet
    > Dim mydataadapter As New SqlDataAdapter(sql, conn)
    >
    > mydataadapter.Fill(ds)
    >
    > ddlModification.DataSource = ds
    > ddlModification.DataBind()
    >
    > End Sub
    >
    > Thanks in advance for any help!!!
    >
    >
    >
    >
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ken Schaefer Guest

  13. #12

    Default Re: SQL error

    Ken,

    Thanks for the direction - you were right on the nose. The SQL now does
    not generate any errors, however there is still nothing in the ddl even
    though this query generates results in the query analyzer. I also didn't
    know about the Response.write tool (Very new to asp!!!!).

    Thanks again for the help - Now back to the grindstone...LOL.

    Dina



    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Dina Womack Guest

  14. #13

    Default Re: SQL error

    For further help, you may wish to see a .NET group.
    [url]http://www.aspfaq.com/5002[/url]

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Dina Womack" <dina_womack@worldnet.att.net> wrote in message
    news:uJ7jFAscEHA.3616@TK2MSFTNGP10.phx.gbl...
    >
    > Please Help!!!
    > I am trying to populate a dropdownlist from information in two other
    > dropdropdownlists on my web page. Everything else works, but I keep
    > getting this error -
    > Incorrect syntax near the keyword 'INNER'.
    >
    > here is the code I am using in the selected index changed event of the
    > 2nd dropdownlist
    >
    > <code>
    > Private Sub ddlModificationType_SelectedIndexChanged(ByVal sender As
    > Object, ByVal e As System.EventArgs) Handles
    > ddlModificationType.SelectedIndexChanged
    >
    >
    > Dim SQLserver As String = "server =
    > localhost;uid=sa;password=;database=master"
    > Dim conn As SqlConnection
    > Dim com As SqlCommand
    > Dim sql As String
    >
    > sql = "select
    > tblStudentModificationList.ModID,ModificationList. ModDesc" & _
    > "FROM (ModificationList)INNER JOIN tblStudentModification ON" &
    > _
    > "ModificationList.ModID = tblStudentModification.ModID" & _
    > "WHERE tblStudentModification.ModID =" &
    > (ddlStudentName.SelectedIndex) & _
    > "AND ModificationList.ModType =" &
    > (ddlModificationType.SelectedIndex) & _
    > "ORDER BY tblStudentModification.ModID"
    >
    >
    > conn = New SqlConnection(SQLserver)
    > com = New SqlCommand(sql, conn)
    >
    > Dim ds As New DataSet
    > Dim mydataadapter As New SqlDataAdapter(sql, conn)
    >
    > mydataadapter.Fill(ds)
    >
    > ddlModification.DataSource = ds
    > ddlModification.DataBind()
    >
    > End Sub
    >
    > Thanks in advance for any help!!!
    >
    >
    >
    >
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Aaron [SQL Server MVP] Guest

  15. #14

    Default SQL Error

    I'm trying to create a dynamic where clause, but I'd like it to be in a single
    string. But I am getting the error below.
    ======================================
    <cfset txtWHERE = "WHERE 0=0 and Dept='ACCT' ">

    <cfquery name="rstResults" datasource="DLCourses">
    SELECT #FORM.txtQSelect#
    FROM courses
    #txtWHERE#;
    </cfquery>
    ======================================
    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in
    query expression '0=0 AND Dept = ''ACCT'''.



    natg504 Guest

  16. #15

    Default Re: SQL Error

    Use PreserveSingleQuotes function:

    #PreserveSingleQuotes(txtWHERE)#

    Also, you don't need that trailing ;
    jdeline Guest

  17. #16

    Default Re: SQL Error

    Thanks!
    natg504 Guest

  18. #17

    Default Re: SQL Error

    Just a friendly tip that you might want to review the statement to make sure
    that you aren't opening yourself up to a SQL injection attack. Since you are
    passing a string variable to be evaluated as SQL, you'll make to make extra
    certain that the variable doesn't contain anything malicious.

    Mike Greider Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139