Oracle style dates in SQL Server

We have an SSRS report on which we want to display the date field in the following format DD-MMM-YY, as in Oracle. This converts dates to25-Jan-11

So, in SQL, which makes the final choice, we use Replace (CONVERT (VarChar, DateTimeColumn,106), ' ', '-')

Is there a better way to do this conversion?

+3
source share
1 answer

Inside SQL Server

SQL Server CONVERT: http://msdn.microsoft.com/en-us/library/ms187928.aspx

No, this particular format is not available, so you do what you have. I usually prefer varchar column size instead of leaving it non-standard.

I also noticed that you have 106, i.e. DD-MMM-YYYY, not DD-MMM-YY. Did you mean to use 6?

REPLACE(CONVERT (varchar(9), DateTimeColumn, 6), ' ', '-')

SSRS

=Format(Fields!DateTimeColumn.Value, "dd-MMM-yy")
+2

Source: https://habr.com/ru/post/1787783/


All Articles