title: Update or insert of view or function failed because it contains a derived or constant field
body: <p>I have been trying to understand what is wrong with the following view, and unfortunately I was not able to find my answer anywhere, other than using triggers, which I would like to avoid. Given the following view, when I try to insert into it I get the error above, however if I remove the inner join to the Company table everything seems to work just fine:</p>
  
  <pre><code>CREATE VIEW [dbo].[vwCheckBookingToCheck]
  WITH SCHEMABINDING
  AS
  SELECT  [checkUser].[CheckID] ,
          [checkUser].[CheckToTypeID] ,
          [checkUser].[CheckNumber] ,
          [checkUser].[CheckDate] ,
          [checkUser].[CheckAmount] ,
          [checkUser].[CheckStatusID] ,
          [checkUser].[CheckAcceptedBy] ,
          [checkUser].[CreatedBy] ,
          [checkUser].[CreatedDateTime] ,
          [checkUser].[CheckToUserID] [ToID],
          [checkUser].[CheckFromCompanyID] [FromID],
          [companyFrom].[CompanyName]
  FROM    [dbo].[CheckUser] [checkUser]
          INNER JOIN [dbo].[Company] [companyFrom] ON [companyFrom].[CompanyID] = [checkUser].[CheckFromCompanyID]
  
  UNION ALL
  
  SELECT  [checkCompany].[CheckID] ,
          [checkCompany].[CheckToTypeID] ,
          [checkCompany].[CheckNumber] ,
          [checkCompany].[CheckDate] ,
          [checkCompany].[CheckAmount] ,
          [checkCompany].[CheckStatusID] ,
          [checkCompany].[CheckAcceptedBy] ,
          [checkCompany].[CreatedBy] ,
          [checkCompany].[CreatedDateTime] ,
          [checkCompany].[CheckToCompanyID] [ToID],
          [checkCompany].[CheckFromCompanyID] [FromID] ,
          [companyFrom].[CompanyName]
  FROM    [dbo].[CheckCompany] [checkCompany]
         INNER JOIN [dbo].[Company] [companyFrom] ON [companyFrom].[CompanyID] = [checkCompany].[CheckFromCompanyID]
  
  GO
  </code></pre>
  
  <p>Here is my insert, I am only inserting in [CheckUser] or [CheckCompany]:</p>
  
  <pre><code>INSERT INTO [dbo].[vwCheckBookingToCheck]   
      ( [CheckToTypeID] ,
        [CheckNumber] ,
        [CheckDate] ,
        [CheckAmount] ,
        [CheckStatusID] ,
        [CheckAcceptedBy] ,
        [CreatedBy] ,
        [CreatedDateTime] ,
        [ToID] ,
        [FromID] 
      )
       SELECT 2,
        'Test' , -- CheckNumber - varchar(255)
        '2014-08-23 20:07:42' , -- CheckDate - date
        1233 , -- CheckAmount - money
        0 , -- CheckStatusID - int
        1 , -- CheckAcceptedBy - int
        1 , -- CreatedBy - int
        '2014-08-23 20:07:42' , -- CreatedDateTime - datetime
        1,  -- ToID - int
        1  -- FromID - int
  </code></pre>
  
  <p>CheckToTypeID is my check constraint, is there any way to make this view work with inner joins? Again, if I remove the inner joins I am able to get it to work, but I would like to keep them if possible.</p>
  
  <p>I am using SQL Server 2012, any help is appreciated.</p>
  
  <p>Thanks,
  Paul</p>