- 12161 Views
- 1 replies
- 2 kudos
How do I add a column to an existing delta table with SQL if the column does not already exist?I am using the following code: <%sqlALTER TABLE table_name ADD COLUMN IF NOT EXISTS column_name type; >but it prints the error: <[PARSE_SYNTAX_ERROR] Synta...
- 12161 Views
- 1 replies
- 2 kudos
Latest Reply
Hi @Christine Pedersen I guess IF NOT EXISTS or IF EXISTS can be used in conjunction with DROP or PARTITIONS according to the documentation. If you want to do this the same checking way, you can do using a try catch block in pyspark or as per your l...
- 10404 Views
- 3 replies
- 5 kudos
How can we alter table with auto increment column for a delta tableI have tried this but not working:ALTER TABLE dbgtpTest.student ADD COLUMN Student_Id identity(100,1)any Suggestions will be helpful
- 10404 Views
- 3 replies
- 5 kudos
Latest Reply
@Rakesh Reddy Badam , For ALTER ... ADD COLUMN in doc is only SYNC IDENTITY.If you want to add an identity column to the existing table just create a new table with an identity column and then copy the data.
2 More Replies
- 1196 Views
- 1 replies
- 1 kudos
I am trying to rename a delta table. But I get the error saying "is not a delta table"
- 1196 Views
- 1 replies
- 1 kudos
Latest Reply
Can you provide a screenshot of the error message and the code snippet?
- 4613 Views
- 1 replies
- 0 kudos
I am a novice with databricks. I am performing some independent learning. I am trying to add a column to an existing table. Here is my syntax:
%sql
ALTER TABLE car_parts ADD COLUMNS (engine_present boolean)
which returns the error:SyntaxError: inva...
- 4613 Views
- 1 replies
- 0 kudos
Latest Reply
Is the table you are working with in the Delta format? The table commands (i.e. Alter) do not work for all storage formats. For example if I run the following commands then I can alter a table. Note - there is no data in the table but the table exist...