Forum Discussion

Martin Lucas's avatar
Martin Lucas
Copper Contributor
Dec 11, 2024

Import from Excel changes Header Names

I have a wide table in Excel with column names like Q1.1, Q1.2, etc. However, when I import this table using SSMS, the column names are renamed to Q1#1#, Q1#2#, and so on.
This renaming is visible when you look at Column Mapping before actually importing.

Is there a way to prevent this renaming? If not, can I write some code to rename the columns afterward? I have 96 columns in this dataset, which I need to upload monthly.

This issue is becoming a nuisance because I want SQL to clean up this dataset before pivoting it and appending it to my final table. Currently, I manually clean up the data in Excel, pivot it, and then upload a tall file with only 4 columns. This method avoids the renaming issue because all the question numbers become values in a column rather than column names.

  • Could you save your Excel file as .csv file?

    I tried use Import wizrd, and choose Flat file source as data source, the column names are correct.

Resources