SQL is importing dates in different format

3

I'm having problems when I select a date column in SQL Server. It turns out that my data is in the dd/mm/aaaa format and when I select that column the SQL inverts getting aaaa-dd-mm and in fact it would have to be aaaa-mm-dd .

This happens on some dates as 02/12/2014 it converts to 2014-02-12 . Column type is datetime2(7)

    
asked by anonymous 13.10.2015 / 14:26

1 answer

3

When you perform SELECT, use the following syntax:

SELECT CONVERT(VARCHAR(23), GETDATE(), 121)

Replace function getdate() with the name of the column you want to convert.

    
13.10.2015 / 19:37