Forum Discussion
Re-deploying a table with a primary key fails using SQL database projects in Azure data Studio
Hi DannyBr ,
The error message you are seeing is due to Synapse Data Warehouse in Microsoft Fabric not supporting certain commands.
In your case, the statement is for adding a check constraint, which is not supported. ALTER TABLE That's why you see the error message when you try to publish again.
In Microsoft Fabric's warehouse, if you need to make changes to a table you need to use, you may need to drop and recreate the table.
Here are two similar questions, check them out:
Data Warehouse - SQL Database Projects Issues + 'A... - Page 2 - Microsoft Fabric Community
Solved: Re: ALTER TABLE statement is not supported in MS F... - Microsoft Fabric Community
I hope this helps! Let me know if you have any additional questions.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
- DannyBr2 years agoFrequent Visitor
Hi Anonymous,
Yes I agree but as stated in my original post this statement is being generated by the ADS deplyment tool not my code.
The ALTER - Add primary key in my code is a valid statement per:
https://learn.microsoft.com/en-us/fabric/data-warehouse/table-constraints#examples
This runs successfully the first time. However on the second publish, with no changes, the error is presented.
The statement being generated by the ADS SQL data project in the publish script is invalid even though I have the correct target selected.
In my opinion this seems to be a fault with the ADS Data project tool or perhaps something I am not setting correctly.
The correct output from the tool should be a "no change" script.
Cheers,
Danny