Forum Discussion

WishAskedSooner's avatar
WishAskedSooner
Continued Contributor
1 year ago
Solved

SQL Server Column Name Change Error

Hi Experts!

 

I am inexperiencing a bizarre error. A column name was changed in SQL Server. I am connecting to the table in PQ via the following:

 

Sql.Database("xx.x.x.xxx", "MyDB", [Query="SELECT * FROM [MyTable];", CreateNavigationProperties=false])

 

However, PQ is still reading in the original column name, and I have no idea why. I even tried to create a New Data source, and it still reads in the original column name, not the updated column name.

 

For additional context, the column that changed names was originally being removed from the Data Model in PQ with a Table.SelectColumns command. I don't know exactly when the column name was changed, but it was a while ago and PBI has been re-started countless times. Now, I need the column.

 

It is like PBI/PQ is stuck on some previous instance of SQL Server. Of course, when I query the table in SSMS, the current column is returned.

 

So, now, I am wondering is part of the problem due to the fact that I am querying the table directly versus a View? What is best practice?

 

Any help is greatly appreciated!

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi,

    Thanks for Greg_Deckler 's concern about the problem and i want to offer some more informaiton for user to refer to.

    hello WishAskedSooner , based on your description, you can click the refresh button in power query after changing the column name in data source.

    And if you need to recreate the connector, you need to clear the data source permission data source serttings in power bi , then reconnect it.

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

3 Replies

    • WishAskedSooner's avatar
      WishAskedSooner
      Continued Contributor

      As you guessed, changing a column name in SQL Server is not a trivial exercise. It involves taking down all your keys, dropping the table, and re-creating it from scratch if doing it manually, or using a tool like SSDT. Why do you ask?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    Thanks for Greg_Deckler 's concern about the problem and i want to offer some more informaiton for user to refer to.

    hello WishAskedSooner , based on your description, you can click the refresh button in power query after changing the column name in data source.

    And if you need to recreate the connector, you need to clear the data source permission data source serttings in power bi , then reconnect it.

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.