Skip to main content
Question

Writing to existing SQL Server table


Hello. I have a workbench that reads an XML and splits it into attributes with their values (with one spatial attribute). I am trying to write this data to an existing, empty SQL Server table. If I set the writer to create a new table, it runs fine, but I can't seem to get it to populate my existing table. The workspace runs, and passes with warnings, but when I go to my SQL Server table it is still empty. Any ideas?

 

 

My writer is configured as follows:

 

Feature operation: Insert

 

Table Handling: Use existing

 

 

The translation log claims that all of my features have been written, and the data inspector shows them fine, but it just won't populate my table.

 

 

Thanks!

 

 

6 replies

  • Author
  • June 26, 2015
the first warning i get is this:

 

 

WARN |MS SQL Server (Spatial) Writer: Could not commit row locally. Provider error 'Description: Unspecified error'. Try turning off 'Bulk Insert'

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • June 27, 2015
Hi,

 

 

Firstly check whether the every feature follows constraints of the existing table.

 

e.g. "not null", "primary key", "foreign key", "unique", "check".

 

 

Takashi

todd_davis
Supporter
Forum|alt.badge.img+21
  • Supporter
  • November 9, 2016

Just had this. The error message didn't provide much detail into what was going on but was able to narrow it down. In my case it was a smallint (not Null) field in SQL that we were trying to pass '' (eg blank) to. @SteveAtSafe


arnold_bijlsma
Enthusiast
Forum|alt.badge.img+14

Just had the same issue. Turned out I had a value > 1000 when the field was set as numeric 5.2. Changed it to numeric 7.2, and the error message no longer occurred.


jkatarski
Participant
Forum|alt.badge.img+1
  • Participant
  • August 23, 2024

In my case it was because there was a slight difference in schema (capitalisation only) so the attributes weren’t actually mapped, even though I’d linked the Reader and Writer. On closer inspection, I was being told this by the tiny gold arrow on the Reader, and the tiny red arrow on the Writer.


bo
Contributor
Forum|alt.badge.img+8
  • Contributor
  • November 6, 2024

I may have encountered another case.  Here is the warning log

 

When I manually constructed and ran the SQL insert statement against the database, I got this error:

Msg 6522, Level 16, State 1, Line 4
A .NET Framework error occurred during execution of user-defined routine or aggregate "geometry":
System.FormatException: 24114: The label %i\x00\x00\x01\x07\x in the input well-known text (WKT) is not valid. Valid labels are POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON and FULLGLOBE (geography Data Type only).
System.FormatException:
   at Microsoft.SqlServer.Types.OpenGisTypes.ParseLabel(String input)
   at Microsoft.SqlServer.Types.WellKnownTextReader.ParseTaggedText(OpenGisType type)
   at Microsoft.SqlServer.Types.WellKnownTextReader.Read(OpenGisType type, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeometry.GeometryFromText(OpenGisType type, SqlChars text, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeometry.Parse(SqlString s)
.
The statement has been terminated.

Here is the image from SQL Log-

I am using the “Microsoft SQL Server Spatial” driver (format) and I was under the impression that it would generate the SQL-flabored WKB for storage.  Not sure why it is ask for WKT.  Perhaps I need to encode the WKB in FME before writing to the target table?

Thanks!

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings