title: Cannot insert the value null error but value isn't actually null
body: <p>I have an error that <em>seems</em> simple to resolve, but I have not been able to do so.  When I run a statement to insert one record into a table I receive the following error:</p>
  
  <pre><code>Cannot insert the value NULL into column 'IsFutureDateAllowForDataSubmission', table 'TableA'; column does not allow nulls. INSERT fails.
  </code></pre>
  
  <p>Simple, right?  I am trying to insert null into a column that doesn't allow it.  However in the INSERT statement <em>I am explicitly inserting a value for that column</em>.  Nothing fancy, no dynamic SQL, no subqueries or anything like that.  I have a simple statement with every value enumerated. This is failing with the above error</p>
  
  <p><code>TableA</code> consists of 81 columns.  It is the configuration table for a large web application.  The column does not allow nulls.  The column data type is a bit (a TRUE/FALSE flag for the application).  I cannot alter the design of the table.</p>
  
  <p>IsFutureDateAllowForDataSubmission Definition:</p>
  
  <pre><code>+------------------------------------+-----------+-----------+-----------+--------+-------+-------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+--------------+
  |            COLUMN_NAME             | DATA_TYPE | TYPE_NAME | PRECISION | LENGTH | SCALE | RADIX | NULLABLE | REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB | CHAR_OCTET_LENGTH | ORDINAL_POSITION | IS_NULLABLE | SS_DATA_TYPE |
  +------------------------------------+-----------+-----------+-----------+--------+-------+-------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+--------------+
  | IsFutureDateAllowForDataSubmission |        -7 | bit       |         1 |      1 | NULL  | NULL  |        0 | NULL    | ((0))      |            -7 | NULL             | NULL              |               63 | NO          |           50 |
  +------------------------------------+-----------+-----------+-----------+--------+-------+-------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+--------------+
  </code></pre>
  
  <p>I am passing in <code>0</code> for <code>IsFutureDateAllowForDataSubmission</code>, I also tried <code>'0'</code>.  Both result in the same error.</p>
  
  <p>I haven't found much online so far other than people trying to add values in columns that are set as an identity, but that scenario is not relevant here as the column I am trying to add a value to is a simple 0/1 flag, not an identity.</p>
  
  <p>I would be happy to provide more information if required.  The actual insert statement is long (81 columns that I am explicitly assigning values to).</p>
  
  <h2>Update</h2>
  
  <p>Here is the table (TableA) definition:</p>
  
  <pre><code>+-------------------------------------------------+----------+----------+--------+-------+-------+----------+--------------------+----------------------+------------------------------+
  |                   Column_name                   |   Type   | Computed | Length | Prec  | Scale | Nullable | TrimTrailingBlanks | FixedLenNullInSource |          Collation           |
  +-------------------------------------------------+----------+----------+--------+-------+-------+----------+--------------------+----------------------+------------------------------+
  | BUSNS_UNIT_ID                                   | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | BUSNS_UNIT_NM                                   | nvarchar | no       |     40 |       |       | yes      | (n/a)              | (n/a)                | SQL_Latin1_General_CP1_CI_AS |
  | ALLOW_RPG_EDIT_FLAG                             | bit      | no       |      1 |       |       | yes      | (n/a)              | (n/a)                | NULL                         |
  | FISCAL_YR_START_MTH                             | tinyint  | no       |      1 |     3 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | INPUT_FORM_EXCEL_FLAG                           | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | SHOW_COMPOSITE_CALCULATION_TYPE                 | bit      | no       |      1 |       |       | yes      | (n/a)              | (n/a)                | NULL                         |
  | DEFAULT_COMPOSITE_CALCULATION_TYPE              | nvarchar | no       |    200 |       |       | yes      | (n/a)              | (n/a)                | SQL_Latin1_General_CP1_CI_AS |
  | MAP_ALL_DEPT_FLAG                               | bit      | no       |      1 |       |       | yes      | (n/a)              | (n/a)                | NULL                         |
  | COMPST_MIN_DLRS_TO_RUN                          | int      | no       |      4 |    10 |     0 | yes      | (n/a)              | (n/a)                | NULL                         |
  | ACCT_DATA_TYP                                   | varchar  | no       |     10 |       |       | yes      | no                 | yes                  | SQL_Latin1_General_CP1_CI_AS |
  | DECIMAL_SEPARATOR_DEFAULT                       | varchar  | no       |     10 |       |       | yes      | no                 | yes                  | SQL_Latin1_General_CP1_CI_AS |
  | FORM_READONLY_FLAG                              | bit      | no       |      1 |       |       | yes      | (n/a)              | (n/a)                | NULL                         |
  | CMPST_RUN_MTHS                                  | int      | no       |      4 |    10 |     0 | yes      | (n/a)              | (n/a)                | NULL                         |
  | CMPST_RUN_YRS                                   | int      | no       |      4 |    10 |     0 | yes      | (n/a)              | (n/a)                | NULL                         |
  | DISPLAY_LCL_ACCT_NBR                            | bit      | no       |      1 |       |       | yes      | (n/a)              | (n/a)                | NULL                         |
  | csv_delimiter                                   | varchar  | no       |      2 |       |       | no       | no                 | no                   | SQL_Latin1_General_CP1_CI_AS |
  | SHOW_PLANS                                      | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | INPUT_FORM_TEMPLATE_NAME                        | nvarchar | no       |    300 |       |       | yes      | (n/a)              | (n/a)                | SQL_Latin1_General_CP1_CI_AS |
  | COMPST_RUN_REVIEWSTATUS_DEFAULT                 | tinyint  | no       |      1 |     3 |     0 | yes      | (n/a)              | (n/a)                | NULL                         |
  | AllowDuplicateAccountData                       | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | FILE_IMPORT_SCHEMA                              | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | ALLOW_DELETE_COMPOSITE                          | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | Disable_Multiple_StarMap                        | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | AllowMasterAccountMap                           | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | ShowCompositesToVendors                         | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | AllowCompositeClosedSnapShot                    | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | SubmissionFrequencyID                           | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | AutoRecalculate                                 | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | ShowDealerCodeAlternate                         | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | ShowSubDealerIndicator                          | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | ShowDealerType                                  | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | OnlineBusinessPlan                              | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | ShowInactiveItemsAdvancedCriteria               | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | HonorRollType                                   | nvarchar | no       |    200 |       |       | no       | (n/a)              | (n/a)                | SQL_Latin1_General_CP1_CI_AS |
  | ShowInactiveDealersDataSubmission               | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | AllowFinancialDataSuppression                   | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | AllowDataSubmissionComments                     | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | RejectMatchingSubmissions                       | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | HonorRollAccuracyPoint                          | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | HonorRollNonSubmissionPoint                     | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | DisableInputFormAccountHighlight                | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | DisableInputFormAuditComments                   | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | EnableSubDealers                                | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | ShowCompositesInDealerProfile                   | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | EnableCarryForwardAuditRemark                   | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | EnableInputFormInlineEvents                     | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | PreventOverMap                                  | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | DefaultAdhocReportVariablesTab                  | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | WorkingCapitalFormula                           | nvarchar | no       |     -1 |       |       | no       | (n/a)              | (n/a)                | SQL_Latin1_General_CP1_CI_AS |
  | InvestmentGuideFormula                          | nvarchar | no       |     -1 |       |       | no       | (n/a)              | (n/a)                | SQL_Latin1_General_CP1_CI_AS |
  | DualDealerAppointmentMonthCutoff                | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | WorkingCapitalSubmissionsStartMonth             | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | WorkingCapitalSubmissionsEndMonth               | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | WorkingCapitalSuccessfulSubmissionsMinimum      | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | WorkingCapitalStartMonth                        | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | WorkingCapitalEndMonth                          | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | WorkingCapitalActivationMonthCutoff             | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | AdhocShowAllUserReports                         | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | AuditResultsLinkStatus                          | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | ShowHistoricCompositesEntitySearch              | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | WorkSheetFullScreenMode                         | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | OnlineBusinessForecast                          | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | IsFutureDateAllowForDataSubmission              | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | SpecialCarryForward                             | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | DmsFileTransferFormat                           | nvarchar | no       |     -1 |       |       | yes      | (n/a)              | (n/a)                | SQL_Latin1_General_CP1_CI_AS |
  | SiteLogo                                        | varchar  | no       |     -1 |       |       | yes      | no                 | yes                  | SQL_Latin1_General_CP1_CI_AS |
  | SubmissionPointsThreshold                       | int      | no       |      4 |    10 |     0 | no       | (n/a)              | (n/a)                | NULL                         |
  | EnableCompositeAverageByDepartment              | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | ViewPreviousSubmission                          | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | HideAuditResultZeroValues                       | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | KeepReleasedFileImportData                      | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | ArlAccountNumberParse                           | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | ConvertForecastRoles                            | nvarchar | no       |     -1 |       |       | yes      | (n/a)              | (n/a)                | SQL_Latin1_General_CP1_CI_AS |
  | ArlEnableUndo                                   | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | UnhideAuditResultSummaryAccountZeroValues       | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | AlwaysShowAuditResultSummaryAccountCarryForward | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | CompositeAverageSummaryAccounts                 | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | DynamicPortfolio                                | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | EnableAllocationAccounts                        | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | EnableTermsAndConditions                        | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  | EnableSimultaneousAudit                         | bit      | no       |      1 |       |       | no       | (n/a)              | (n/a)                | NULL                         |
  +-------------------------------------------------+----------+----------+--------+-------+-------+----------+--------------------+----------------------+------------------------------+
  </code></pre>
  
  <p>And here is the full INSERT statement that generates the error:</p>
  
  <pre><code>INSERT INTO TableA SELECT
  '14' AS BUSNS_UNIT_ID,
  'Global' AS  BUSNS_UNIT_NM,
  '0' AS  ALLOW_RPG_EDIT_FLAG,
  '1' AS  FISCAL_YR_START_MTH,
  '1' AS  INPUT_FORM_EXCEL_FLAG,
  '0' AS  SHOW_COMPOSITE_CALCULATION_TYPE,
  'ANNUALIZATION' AS  DEFAULT_COMPOSITE_CALCULATION_TYPE,
  '0' AS  MAP_ALL_DEPT_FLAG,
  '3' AS  COMPST_MIN_DLRS_TO_RUN,
  'Cumulative' AS  ACCT_DATA_TYP,
  'Period' AS  DECIMAL_SEPARATOR_DEFAULT,
  '0' AS  FORM_READONLY_FLAG,
  '25' AS  CMPST_RUN_MTHS,
  '3' AS  CMPST_RUN_YRS,
  '1' AS  DISPLAY_LCL_ACCT_NBR,
  ',' AS  csv_delimiter,
  '0' AS  SHOW_PLANS,
  NULL AS  INPUT_FORM_TEMPLATE_NAME,
  '4' AS  COMPST_RUN_REVIEWSTATUS_DEFAULT,
  '0' AS  AllowDuplicateAccountData,
  '0' AS  FILE_IMPORT_SCHEMA,
  '1' AS  ALLOW_DELETE_COMPOSITE,
  '0' AS  Disable_Multiple_StarMap,
  '0' AS  AllowMasterAccountMap,
  '1' AS  ShowCompositesToVendors,
  '0' AS  AllowCompositeClosedSnapShot,
  '1' AS  SubmissionFrequencyID,
  '0' AS  AutoRecalculate,
  '0' AS  ShowDealerCodeAlternate,
  '0' AS  ShowSubDealerIndicator,
  '0' AS  ShowDealerType,
  '0' AS  OnlineBusinessPlan,
  '1' AS  ShowInactiveItemsAdvancedCriteria,
  'SUBMISSION' AS  HonorRollType,
  '0' AS  ShowInactiveDealersDataSubmission,
  '0' AS  AllowFinancialDataSuppression,
  '1' AS  AllowDataSubmissionComments,
  '1' AS  RejectMatchingSubmissions,
  '0' AS  HonorRollAccuracyPoint,
  '0' AS  HonorRollNonSubmissionPoint,
  '0' AS  DisableInputFormAccountHighlight,
  '0' AS  DisableInputFormAuditComments,
  '0' AS  EnableSubDealers,
  '1' AS  ShowCompositesInDealerProfile,
  '0' AS  EnableCarryForwardAuditRemark,
  '0' AS  EnableInputFormInlineEvents,
  '0' AS  PreventOverMap,
  '0' AS  DefaultAdhocReportVariablesTab,
  '' AS  WorkingCapitalFormula,
  '' AS  InvestmentGuideFormula,
  '0' AS  DualDealerAppointmentMonthCutoff,
  '0' AS  WorkingCapitalSubmissionsStartMonth,
  '0' AS  WorkingCapitalSubmissionsEndMonth,
  '0' AS  WorkingCapitalSuccessfulSubmissionsMinimum,
  '0' AS  WorkingCapitalStartMonth,
  '0' AS  WorkingCapitalEndMonth,
  '0' AS  WorkingCapitalActivationMonthCutoff,
  '0' AS  AdhocShowAllUserReports,
  '0' AS  AuditResultsLinkStatus,
  '0' AS  ShowHistoricCompositesEntitySearch,
  '0' AS  WorkSheetFullScreenMode,
  '0' AS  SpecialCarryForward,
  NULL AS  DmsFileTransferFormat,
  NULL AS  SiteLogo,
  '0' AS  SubmissionPointsThreshold,
  '0' AS  EnableCompositeAverageByDepartment,
  '1' AS  ViewPreviousSubmission,
  '0' AS  HideAuditResultZeroValues,
  '1' AS  KeepReleasedFileImportData,
  '0' AS  ArlAccountNumberParse,
  NULL AS  ConvertForecastRoles,
  '0' AS  ArlEnableUndo,
  '0' AS  UnhideAuditResultSummaryAccountZeroValues,
  '0' AS  AlwaysShowAuditResultSummaryAccountCarryForward,
  '0' AS  CompositeAverageSummaryAccounts,
  '0' AS  OnlineBusinessForecast,
  '0' AS  IsFutureDateAllowForDataSubmission,
  '0' AS  DynamicPortfolio,
  '0' AS  EnableAllocationAccounts,
  '0' AS  EnableTermsAndConditions,
  '0' AS  EnableSimultaneousAudit
  </code></pre>
  
  <p>The INSERT statement is generated after configuring things in an Excel spreadsheet.</p>