I need to convert date time
to nvarchar
on sql server like 2011 Oct 24
but I'm not able to convert into this. Can anyone help?
相关问题
- Sorting 3 numbers without branching [closed]
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Graphics.DrawImage() - Throws out of memory except
- Difference between Types.INTEGER and Types.NULL in
You can find all of the conversion codes here: http://msdn.microsoft.com/en-us/library/ms187928.aspx
For, exact format you required, you need to get all parts(day,month and year) of date seperately like :
You can also user convert function for other formats like :
Output:
There's no format that matches exactly. You can use
substring
to assemble the format manually:N.B. Doing formatting in SQL is much harder than client-side, in C# or Java or Ruby.