"RuntimeError: Catalog Error: Can only modify view with ALTER VIEW statement" When trying to rename a column while using DataFrame SQL within Deepnote
ALTER TABLE df RENAME COLUMN V41690973 TO cpi;
A screenshot giving some more context
You can use the SELECT * EXCLUDE (col_name) syntax in combination with Deepnote's ability to overwrite the variable df from Dataframe SQL to rename a column like this:
SELECT * EXCLUDE (col_name)
df
SELECT col1 as col1_renamed, * EXCLUDE (col1) FROM df
Here's a published reproducible notebook: https://deepnote.com/@the21st/Rename-a-column-using-DataFrame-SQL-1864ef27-a977-4039-bdc5-3b81215a2f2e in case you want to fork it and try it yourself.
By following way we can Rename Column name in MSSQL
EXEC sp_rename 'TableName.FromColumnaname', 'Tocolumn';
To change table name
EXEC sp_rename 'FromTableName', 'ToTableName';
Make sure that have you using anywhere in SP's or Functions it may effect functionality
Copyright © 2021 Jogjafile Inc.
You can use the
SELECT * EXCLUDE (col_name)
syntax in combination with Deepnote's ability to overwrite the variabledf
from Dataframe SQL to rename a column like this:Here's a published reproducible notebook: https://deepnote.com/@the21st/Rename-a-column-using-DataFrame-SQL-1864ef27-a977-4039-bdc5-3b81215a2f2e in case you want to fork it and try it yourself.