0

I have a table(tabl) with column(Col) that is nvarchar(10) data type.

I am not suppose to change the data type or data length. The column contains date in this format yyyy-mm-dd (2012-04-24) I need to update that column to mm/dd/yyyy(04/24/2012).

4

1 回答 1

0

这是一组可怕的约束,但你要问的是可能的:

UPDATE tabl SET col = CONVERT(nvarchar(10), CAST(col AS datetime), 101)

最后101是从该页面获取的适当日期样式:http: //msdn.microsoft.com/en-us/library/ms187928.aspx

但是,结果是您将拥有难以排序且格式不明确的日期。作为 a 存储datetime是值得尊敬的事情。

于 2013-03-14T04:59:34.723 回答