Insert fails when trying to create a table.

  • CREATE TABLE [EmailDeployment](
        [EmailDeploymentKey] [bigint] NULL,
        [ProgramID] [int] NULL,
        [CampaignID] [int] NULL,
        [EmailAssetID] [int] NULL,
        [ProgramName] [varchar](255) NULL,
        [EmailAssetName] [varchar](255) NULL,
        [EmailType] [varchar](100) NULL,
        [SendDate] [datetime] NULL,
        [StartDate] [datetime] NULL,
        [Channel] [varchar](100) NULL,
        [TagType] [varchar](100) NULL,
        [TagValue] [varchar](100) NULL,
        [ProcessedInd] [char](1) NULL,
        [Reporting_period] [varbinary](6) NULL,
        [Activity_Month] [int] NULL,
        [Activity_Year] [int] NULL
    )

    And this is the error I get

    Cannot insert the value NULL into column 'ID'. table 'dbo.NewFarmreachTables'; column does not allow nulls. INSERT fails.

  • Are there any DDL triggers defined on the instance you are trying to create the table?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • newdba2017 - Wednesday, September 27, 2017 12:20 PM

    CREATE TABLE [EmailDeployment](
        [EmailDeploymentKey] [bigint] NULL,
        [ProgramID] [int] NULL,
        [CampaignID] [int] NULL,
        [EmailAssetID] [int] NULL,
        [ProgramName] [varchar](255) NULL,
        [EmailAssetName] [varchar](255) NULL,
        [EmailType] [varchar](100) NULL,
        [SendDate] [datetime] NULL,
        [StartDate] [datetime] NULL,
        [Channel] [varchar](100) NULL,
        [TagType] [varchar](100) NULL,
        [TagValue] [varchar](100) NULL,
        [ProcessedInd] [char](1) NULL,
        [Reporting_period] [varbinary](6) NULL,
        [Activity_Month] [int] NULL,
        [Activity_Year] [int] NULL
    )

    And this is the error I get

    Cannot insert the value NULL into column 'ID'. table 'dbo.NewFarmreachTables'; column does not allow nulls. INSERT fails.

    And how does the table above relate to the error?

    Never mind, brain was not in gear.

  • Phil Parkin - Wednesday, September 27, 2017 12:27 PM

    Are there any DDL triggers defined on the instance you are trying to create the table?

    After disabling triggers, it's working.

  • newdba2017 - Wednesday, September 27, 2017 1:03 PM

    Phil Parkin - Wednesday, September 27, 2017 12:27 PM

    Are there any DDL triggers defined on the instance you are trying to create the table?

    After disabling triggers, it's working.

    You would be better troubleshooting the trigger though, rather than disabling it. The trigger will be there for a reason, and if you can't create tables, it would seem it's miss performing.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • newdba2017 - Wednesday, September 27, 2017 1:03 PM

    Phil Parkin - Wednesday, September 27, 2017 12:27 PM

    Are there any DDL triggers defined on the instance you are trying to create the table?

    After disabling triggers, it's working.

    Why, on this good green Earth, would you disable a trigger that you know nothing about?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 6 posts - 1 through 5 (of 5 total)

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