-1

When I copy the data from query results of Sql Server db and pasted it on Excel the hyphenated text get converted to the date.

Like 2-12 gets converted to 12-Feb. How can I avoid that?

1 Answers1

0

One way is to in your SQL server query convert the SQL server column to text and then append an apostrophe in front of it. When you paste that into Excel it should be pasted as text, not as a date. E.g.

SELECT '''' + CONVERT(nvarchar,Field_Name) FROM Table_Name

You likely will then need to select the column in Excel, right click it, select Format Cells and then change the format to text. You can then replace the apostrophe and the column will be preserved as text and not automatically converted to a date format.

Arconath
  • 423
  • 3
  • 8