0

I already have about 100 values in a field in QGIS. I set it to 50 characters because I was thinking that would be enough. But that was wrong. I need more space in the column. But there is no way to change it. In the usual editor you only can remove or add a new field.

And in the "advanced" table manager you can change the position and rename it. But nowhere where I edit the length of a field.

The only thing I could do is creating a new field with more space. Then import the data somehow. But does that work somehow? Or is there a way to edit the text length afterwards. I'm also interested in hacks.

And yes I really need that. There is no way to get the string any shorter. I think 100 chars are fine.


Now it came to mind the following. Could maybe someone tell if that is working before I try that. So First of all I would create a new field with 100 chars column. Than select all old features and CTRL-X them and CTRL-V into the new shape.

Will that work out?

  • Please include the data format in data questions; it's trivial to increase the width of database tables and impossible with shapefiles. – Vince Mar 20 '15 at 2:35
  • I don't think any data example are needed here. The question is straightforward. But thanks for the info that it's impossible on shapefiles. I now just created a new column and copy pasted by hand. 2 Minutes =) – kwoxer Mar 20 '15 at 7:58
  • 1
    Not data sample, data format, since the options change by format. There may also be a maximum width per row (4kb for dBase < 50*100) – Vince Mar 20 '15 at 10:59
1

The field calculator lets you easily create new fields and insert all values of an existing field in one step.

With the table manager plugin, you can delete the old field, and rename the new one to the name of the deleted field. This will work for shapefiles, but not for spatialite and postgis database tables. You have to use SQL statements for those.

  • Is there anywhere an tutorial that shows that scenario? – kwoxer Mar 19 '15 at 18:09
  • qgistutorials.com/en/docs/working_with_attributes.html might be a start-off. Just try it out on a copy of your datasource. – AndreJ Mar 19 '15 at 18:15
  • Well that did not work for me. But I have now done the following. Create new column and copy paste all the text into the new column. I think this was the fastest and easiest way. But thanks anyway. – kwoxer Mar 20 '15 at 7:57
  • I wonder why the field calculator did not work for you. – AndreJ Mar 20 '15 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.