Convert datetime to nvarchar but keep format

datetime, sql-server, sql-server-2005

Solution

Declare @CreatedDate datetime
Select @CreatedDate='20121210'
Select CONVERT(VARCHAR,@createdDate, 21)

Problem

I am returning either a DATETIME or the NVARCHAR = 'MULTIPLE' depending on whether or not an action has been performed more than one time. So I am trying to store the DATETIME in its normal format '2012-10-23 13:59:47.000' but as an NVARCHAR. SQL wants to make it 'Oct 23 2012 12:40PM' How can I do this? Right now I am doing: ``` CAST(r.Date_And_Time) AS NVARCHAR(30)) ```

Original source