-2

I am new to SQL Server and trying to get date from database in the requested format.

I am trying this query to achieve the result.

select * 
from datetable
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
test
  • 1
  • 2
  • did you even attempt to research this problem. there are numerous similar questions on the site. – Tanner Jan 06 '17 at 11:39

4 Answers4

1

Another option is Format()

Select Format(somedate,'dd MMM yyyy')
John Cappelletti
  • 79,615
  • 7
  • 44
  • 66
0

you can use convert function to get required result.

select convert(varchar,getdate(),106)

Result:

06 Jan 2017
Shahzad Riaz
  • 354
  • 1
  • 6
0

If your datatype is DATETIME or DATETIME2 then you can use CONVERT()

SELECT CONVERT(VARCHAR(12), DATECOLUMN, 106)
FROM DateTable
Radu Gheorghiu
  • 20,049
  • 16
  • 72
  • 107
0
select *,Convert(varchar,DateColumn,106) as NewDate  from datetable
Anurag_Soni
  • 542
  • 2
  • 17