SQL Server Performance

cannot insert null into column

Discussion in 'General Developer Questions' started by dhamu294, May 7, 2009.

  1. dhamu294 New Member

    1. Cannot insert the value NULL into column ''sector'', table ''tempdb.dbo.#calcsi_____________________________________________________________________________________________________________00020002DCFC''; column does not allow nulls. INSERT fails.
    this error will be go, if i say explictly null when i create the table. i hope by default it is null and it is working fine in other servers. only in my test environment i am facing this kind of issue.
    do i change any setting to avoid this error.
    eg
    create table #calcsi
    ( suinquied int not null ,
    sector int,
    column1 varchar (30),
    column2 varchar (30) )
    for above eg. is that necessary to say null if we want to allow null value. in my case by default it is taking has not nul.. what setting should be changed for this
  2. ndinakar Member

    What does your INSERT statement look like?
  3. dhamu294 New Member

    insert into #calcsi ( suinquied,sector,column1,column2) select co1,col2,col3,col4 from table1
    if any of the column is null in the table1 it is thorowing this kind of error.
    afte i say expliclty null to the specific column this error not coming.
  4. ndinakar Member

    Check the setting SET ANSI_NULL_DFLT_OFF in books on line. This setting might be affecting your commands.

Share This Page