I have been facing an issue with using CREATE TABLE AS. I have made three tables in a database. I intend to join the tables based on policy number and create a new table out of the joined data.
CREATE TABLE [dbo].[New_Customer_Segmentation_Data] AS
(
SELECT *
FROM [dbo].[CustomerSegmentation_updated]
INNER JOIN [dbo].[DimLapse]
ON [dbo].[CustomerSegmentation_updated].[PolicyNumber] = [dbo].[DimLapse].[Policy Number]
INNER JOIN [dbo].[dimclaim]
ON [dbo].[DimLapse].[Policy Number] = [dbo].[dimclaim].[POLICYNUMBER]
)
It returns the error "'Distribution' option must be explicitly specified in "CREATE TABLE AS SELECT" and "CREATE MATERIALIZED VIEW" statements." Can anyone guide me on this error?
Just like the error message says, you must specify a Distributed table design option with CTAS, eg from the docs:
CREATE TABLE [dbo].[FactInternetSales_new]
WITH
(
DISTRIBUTION = ROUND_ROBIN
,CLUSTERED COLUMNSTORE INDEX
)
AS
SELECT *
FROM [dbo].[FactInternetSales];
CREATE TABLE AS SELECT
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With