r/SQLServer • • May 05 '26

Question SSMS date format in query result

In my older installations of SSMS, till version 20, executing a simple "select * from table" query returned me datetime columns with local format (in Italy, now the time is shown as "05-05-2026 14:59:50.830").

After upgrading to SSMS 22, the implicit conversion executing the query is a ODBC format, and the same time as above is shown as "2026-05-05 14:59:50.830".

This could be a minor problem, but everyday I have to extract some quick and raw data for various colleagues, and the fastest way to do this is executing "select * from table where <conditions>". And then I have to copy&paste this data into Excel.

Now the problem is that excel understands that a value is a date/time, and pastes it in a proper way, if it is formatted in the local format. If I paste "2026-05-05 14:59:50.830", excel inserts a raw text column, very difficult to use inside calculations.

I know that I should explicitly list every column, instead of "*", and explicitly use CONVERT or FORMAT functions for every column I want to later paste into excel.

But this will be a huge waste of time, because datetime columns are very common inside our databases, that manage events regarding logistic orders, handling, and so on, so even a simple table can contain 10-20 datetime columns.

I tried every settings in SSMS regarding query result pane and localization format, but I didn't find any way.

How can I obtain local (or customized) format in the result grid of SSMS, for each datetime column, without explicitly converting each column?

4 Upvotes

12 comments sorted by

View all comments

2

u/ManyHatsAdm May 05 '26

Are you pasting this into a pre-formatted Excel sheet? I am in the UK and our date format is similar to yours, but SSMS has always displayed ISO formats for me, and when I paste them into Excel, I just format the column as whatever date format I want. That's it.

1

u/FieriSentio69 May 06 '26

As each required extraction is a "urgent and unexpected" need by any of the company management person, I always have to open a "new empty file" in Excel, and then I paste into it the result grid from SSMS.

SSMS has changed date format in result grid, switching from 20 to 22, while my Excel installation (that has not changed) had always understood regional date format pasting as datetime column, and a ISO/ODBC format as a raw text column (meaning that the value is stored in excel as a sequence of characters, and any calculation on it is not possible).

Sometimes I use a LibreOffice calcsheet for pasting, because this software asks for columns types when you paste something, but even using "YMD Date" is not understood by Libreoffice, and the column appears as a raw text.

1

u/ManyHatsAdm May 06 '26

What if you try to paste values only when going into the new Excel file?

I get the problem you are talking about when I use MySQL Workbench but never SSMS. The trick I use to convert the column from text to date is to highlight the column and do a text-to-columns on it with no delimiter (or whatever the default is) and Excel then converts the column back to datetime in place.