Skip to main content
Question

Failed to write to Azure SQL table

  • October 8, 2019
  • 6 replies
  • 104 views

torbjornd
Contributor
Forum|alt.badge.img+5

Hi.

I'm trying to write some data into a table which consists of two foreign keys. As you can see on the attached image, I'm reading from two tables, Equipment and WaterMeterPnt. Equipment contains a field BuildingId which I'm going to add to the table WaterMeterPntBuilding. I'm joining the two tables on an common field. The table WaterMeterPntBuilding contains just two fields which is foreign keys.

When I try to run this, I get this error when writing:

Microsoft SQL Server Non-Spatial Writer: Failed to create Azure table 'dbo.WaterMeterPntBuilding' because no clustered index or primary key was specified.

I'm sure that the values exists in the tables and I'm using the existing table, not creating the table each time.

 

Regards,

Torbjørn

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

sigtill
Supporter
Forum|alt.badge.img+25
  • Supporter
  • October 9, 2019

Hi Torbjørn! If you double click on the writer Feature and user attribues. Does it say Definition: Automatic - manual or dynamic? Can you post a screenshot of both Parameters and User Attributes


torbjornd
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 15, 2019

Here are the details, @sigtill . For the attribute definition I'm using manual since the table is imported directly from the writer

As for the parameters, I'm inserting values and trying to use the existing table:

 

Torbjørn


sigtill
Supporter
Forum|alt.badge.img+25
  • Supporter
  • October 15, 2019

Here are the details, @sigtill . For the attribute definition I'm using manual since the table is imported directly from the writer

As for the parameters, I'm inserting values and trying to use the existing table:

 

Torbjørn

What if you switch to Attribute handling: Automatic ?


torbjornd
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 15, 2019

What if you switch to Attribute handling: Automatic ?

I get the same error:

Microsoft SQL Server Non-Spatial Writer: Failed to create Azure table 'dbo.WaterMeterPntBuilding' because no clustered index or primary key was specified. If creating a new table, go into the 'User Attribute' tab and set the 'Index' column to 'clustered', 'clustered_not_null', or 'primary_key' for a column


sigtill
Supporter
Forum|alt.badge.img+25
  • Supporter
  • October 15, 2019

I get the same error:

Microsoft SQL Server Non-Spatial Writer: Failed to create Azure table 'dbo.WaterMeterPntBuilding' because no clustered index or primary key was specified. If creating a new table, go into the 'User Attribute' tab and set the 'Index' column to 'clustered', 'clustered_not_null', or 'primary_key' for a column

So go to manual and change Index column to clustered to see if that works - even though you are not creating a new table.


david.benoit

Certain Sql Server Azure database versions REQUIRE either a Primary Key on a table or a Clustered Index. If your table(s) do not have either, then you need to create a clustered index on the table.

 

Sql Code:

 

CREATE CLUSTERED INDEX IX_TableName_colName

ON [dbo].[TableName] (colName);

GO