Advertisement
Guest User

Untitled

a guest
May 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. CREATE TABLE [dbo].[Temp] (
  2. [Word] VARCHAR (MAX) NULL,
  3. [SFI] REAL NULL,
  4. [U] INT NULL,
  5. [D] REAL NULL
  6. );
  7.  
  8. MERGE [dbo].[Word] as target
  9. USING [dbo].[Temp] as source
  10. ON target.[WordId] = source.[Word]
  11. WHEN MATCHED THEN
  12. UPDATE SET [NAWL963SFI] = source.[SFI], [NAWL963U] = source.[U], [NAWL963D] = source.[D]
  13. WHEN NOT MATCHED THEN
  14. INSERT ([WordId],[NAWL963SFI],[NAWL963U], [NAWL963D], [NAWL963])
  15. VALUES (source.[Word],source.[SFI],source.[U], source.[D], 1);
  16.  
  17. Msg 515, Level 16, State 2, Line 41
  18. Cannot insert the value NULL into column 'WordId', table 'ab.dbo.Word'; column does not allow nulls. UPDATE fails.
  19. The statement has been terminated.
  20.  
  21. SELECT count(*) from Temp where Word = null;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement