troubleshooting Question

Unable to Insert Date from one table to another

Avatar of wally_davis
wally_davisFlag for United States of America asked on
Microsoft SQL Server 2005
4 Comments1 Solution264 ViewsLast Modified:
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.
Thank you,
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 4
Cannot 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.
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros