The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
AndreaF
3 years agoContributor III
Create Table As Select
Hi, I need to build some tables in the application database. I am using a extensibility rule with a StringBuilder and the BRAPi.Database.ExecuteActionQuery command to do that.
The "Create table" co...
- 3 years ago
After testing many suggestions I found that the following line of code does what I was looking for, i.e. it creates a table which is a copy of the old table, without copying any data from the old table (because of the Where 1 = 2 condition):
sqlScript.AppendLine("Select * Into EBSRegister From XFW_PLP_Register Where 1 = 2")
- 3 years ago
Yes you're on the right track though the new table won't have the indexes/constraints copied over.
The "Create Table As Select (CTAS)" only works in Azure Synapse Analytics Platform System aka PDW. Also works in oracle but not in SQL Server.
AndreaF
3 years agoContributor III
After testing many suggestions I found that the following line of code does what I was looking for, i.e. it creates a table which is a copy of the old table, without copying any data from the old table (because of the Where 1 = 2 condition):
sqlScript.AppendLine("Select * Into EBSRegister From XFW_PLP_Register Where 1 = 2")
Sai_Maganti
3 years agoContributor II
Yes you're on the right track though the new table won't have the indexes/constraints copied over.
The "Create Table As Select (CTAS)" only works in Azure Synapse Analytics Platform System aka PDW. Also works in oracle but not in SQL Server.
Related Content
- 3 years ago
- 1 year ago
- 2 years ago