I have a problem which confuses me.
I added a column, ChangeDate, datatype of datetime and set the default value/Binding to getdate().
I populated the ChangeDate column, using a query by extracting from another column, RecUpdate, datatype nvarchar(50).
RecUpdate looks like this: UPDATED-4/6/2011 10:11:59 AM. This a string created with coding.
Notice the format of the date is M/D/YYYY
The query executed fine, but it formatted the dates this way: 2011-04-06 10:11:59.000. It formatted it as YYYY-MM-DD.
Why is this? Do I need to add a format to my query? The query is listed below:
Update BuildingMaster set ChangeDate = (cast(SUBSTRING(RecUpdate 9, 30) AS datetime))