My two tables look like this:
1. Table name = main, Columns are Mac (PK, bigint, not null), Created (datetime, null) and Modified (datetime, null)
2. Second table, Table name = Uptime, Columns are Uptime_ID (PK, bigint, not null), Mac (FK, nchar(19), not null), LastResponse (smalldatetime, null), Status (nchar(10) and Flag (varchar(10).
Trust Relationship --> Main.MAC = PK and Uptime.MAC = FK. Cascade on Update and Insert are set on both tables.
The problem I'm having is that when I attempt to run this routine bellow in code snippet.
I also reseed the Uptime table and when I run a Select * From Main where Mac = '' it doesn't find any NULL data.
I'm stuck so I really need an experts advice on what else would be preventing the Main.Mac from updating the Uptime.Mac table.
declare @MAC nchar(18)SELECT Mac from Main INSERT INTO uptime ( Mac ) Values( @MAC )I get this error --> (16563 row(s) affected)Msg 515, Level 16, State 2, Line 4Cannot insert the value NULL into column 'MAC', table 'platform_validation_tool.dbo.Uptime'; column does not allow nulls. INSERT fails.The statement has been terminated.
You can do either one of two things:
1) alter table "uptime" so that column "Mac" allows NULL values.
2) Excute the following query:
Open in new window