I have a table with datetime2(7) column.
I create command parameters like this:
cmdInsertActionNote.Parameters.Add("@DateTimeUTC", SqlDbType.DateTime2);
And I populate and execute command like:
cmdInsertActionNote.Parameters["@DateTimeUTC"].Value = DateTime.utcNow;
int rowsAffected = cmdInsertActionNote.ExecuteNonQuery();
In my sql table I see:
2016-12-01 13:53:13.0700000
So I have milliseconds, but only ever 0 for last 4 digits.
What am I doing incorrectly?
EDIT 1:
For those who think it is a windows issue - it is NOT for me I have windows Server 2008 and I get microseconds. Here is a "time" column value populated from c#/datetime.utcNow.TimeOfDay:
12:06:56.6550029