Select to view content in your preferred language

Join SQL server table to shapefile that has exceeded max characters?

1099
1
09-10-2014 01:10 AM
ChrisBuckmaster1
Deactivated User

Hi

I have a SQL server table that has information that I would like to join to a shapefile, but a couple of the fields exceed the maximum number of characters allowed for a shapefile in a field (one field has 300 and the other 500).

It is a python script I am trying to compile, and when using the add join tool it gave me an error stating the fields were too large. Can anyone suggest how I can get this information over to my shapefile? Would creating fields in the shapefile and then calculating values work or would that error? I would be happy to only get the maximum number of characters allowed in the field for a shapefile (254?).

Hope that makes sense, any advice would be great!

Tags (2)
0 Kudos
1 Reply
ChrisMathers
Deactivated User

Depending on the size of the SQL table you could copy it all into a dictionary and then use a cursor to grab the data based on your join field. That would allow you to alter the data as it was being written in and slice the strings to the length you need. Not practical if the table is huge, though I do this regularly with our entire 117,000 record parcel feature class. The dictionary would be formatted as {join_field:{field1:value1,field2:value2,...}. So the key for each row in the dict would be the value from the join field in the SQL table and the value for that would be another dictionary of each field in the SQL table.

0 Kudos