So I’m working on some SQL for a program I am developing, and I am having an odd issue that I’ve never really seen before. Here is the query that’s giving me trouble:
insert into [db].[dbo].[table] (JobNum, JobSeq, OperationNumber, WorkCenter,
ResourceGroup, Material, MaterialQuantity, MaterialCost, LbrHoursPerPiece,
ExtendedDescription, PreviousMaterial, UniqueID)
values ('J000001234', 1234, 123, 'UFAN', 'FANASSY', '12345678',
4, 50, 1, 'DESC', '', '')
I then do a select from the same table:
SELECT * FROM [db].[dbo].[table]
where JobNum = 'J000001234'
And this is what is returned:

For some reason, even though I give it a value of 50, the MaterialCost field is showing NULL, and I can’t figure out why when everything else is being inserted properly. Here is the table design, just in case:

Any thoughts?
EDIT: I want to point out that while this is a query I’m using in .NET code, for now I am only testing it in SQL Server Management Studio.
Also, a commenter asked for the create query, so:
...
CREATE TABLE [dbo].[table](
[JobNum] [nvarchar](20) NOT NULL,
[JobSeq] [int] NOT NULL,
[OperationNumber] [int] NULL,
[WorkCenter] [nvarchar](6) NULL,
[ResourceGroup] [nvarchar](30) NULL,
[Material] [nvarchar](30) NULL,
[MaterialQuantity] [decimal](18, 8) NULL,
[MaterialCost] [decimal](18, 5) NOT NULL,
[LbrHoursPerPiece] [decimal](10, 5) NULL,
[ExtendedDescription] [nvarchar](300) NULL,
[PreviousMaterial] [nvarchar](300) NULL,
[UniqueID] [varchar](200) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
ALTER TABLE [dbo].[Table] ADD CONSTRAINT [DF_Table_MaterialCost] DEFAULT ((0.00)) FOR [MaterialCost]
GO
EDIT 2: So I took the CREATE TABLE query and used it to create another table, tableTEST, that is identical to the trouble table. When executing the same query on the TEST table, it worked fine. I also want to point out that the MaterialCost field that isn’t getting the right data was added to the table much later after initially creating it.
In the end, I was able to solve the problem without ever discovering the root cause. The MaterialCost field was added to the table much later after it already had a fairly large amount of data, so there was obviously something odd going on there.
To fix my problem, I created a copy of the original table, copied all of the data over to the new table, and dropped the original. After doing that, the insert statement worked properly. So like I said, it works now, but I don’t really have any details on the root cause, other than that field being new.