Monday, 20 May 2019

prevent excel formatting as number


I have to copy from SQL Server Management Studio often. Many of our ID column fields are filled with numbers but have the data type varchar. When copying output from SSMS to Excel MSOffice determines the column is a number and consequently strips the prepended zeroes from the number. If I convert the column back to "text" under "Format cells," the 0 is lost.


How can I keep the zeroes?



Answer



Use the Data tab and import directly from the SQL Server. This will maintain the field types as you import and refresh the data.


Maintain zeros in Front


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...