I am running into an error I am having trouble figuring out.
I have 2 tables and I'm trying to copy data from one to the other (simplified view):
MyTable
-------
ID varchar(11) do not allow nulls
Field01 numeric(6,0) allow nulls
MyTable_Temp
------------
ID varchar(11) do not allow nulls
Field01 numeric(6,0) allow nulls
My query looks like this:
DELETE FROM dbo.MyTable
INSERT INTO dbo.MyTable([ID],[Field01])
SELECT ID, Field01 FROM [dbo].MyTable_Temp WITH (NOLOCK)
However when I run my query it throws this error:
Msg 242, Level 16, State 3, Procedure TRG_MyTable, Line 6 The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
If I comment out the Field01 part of the query it runs fine. How can a numeric field throw a datetime error?