Tsql date column update

I have a date column that is in yyyy-mm-dd I want to convert it to dd/mm/yyyyy. The data type for this column is nvarchar(20) .I am willing to change the data type. The query i tried is

Update table1
set Column1= Convert(nvarchar(10),column1,101). 

It is executing but is not making any change.


You need to convert the value twice,

Update table1 
set Column1 = CONVERT(nvarchar(10),CONVERT(datetime, REPLACE(column1,'-','.'), 102), 103)

Your data is not really a date. It is currently a string, so Convert won't have any effect.

You would need to:

update table1 set Column1 = Convert(nvarchar(10), Convert(datetime, column1), 101)

but better still, you should consider changing the column data type to datetime, then converting it to the desired format when you select data from the table.

Need Your Help

fill half bgcolor of calendar square

php html css

I have followed this tutorial: http://www.phpjabbers.com/how-to-make-a-php-calendar-php26-6.html#comments to make a very basic calendar. My aim is to create a very basic availability calendar whereby

Find previous and next images in div with JQuery

javascript jquery html css3

I need to find the next and previous image starting from the img with the 'active' class within a div. The problem is, the search for the previous and next image always return a length of 0, so not...