Source language: Translate to:

Lengthing string field

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Lengthing string field

Postby BRobinsonS » Thu Apr 18, 2013 2:15 pm

Creating a new table I left a string field too short (25 characters). Now I need 30 characters.
Is there a way to lengthen the field using DBPro or Sql ?
Especially if there is data in this field.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Re: Lengthing string field

Postby Neosoft Support » Thu Apr 18, 2013 3:10 pm

Try this on a copy of the database first!

You should be able to increase the size of the field with the following SQL statement:

ALTER TABLE tablename ALTER COLUMN fieldname varchar(30)
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Lengthing string field

Postby BRobinsonS » Thu Apr 18, 2013 6:29 pm

It works. Thank you.

Now, I do have a list box that lists the fields of the table and a subroutine which refreshes the list when I add Field or drop a field which works.

It shows the field length type and length e.g. bizname string(50), but after using the SQL command and have the field list refresh it doesn't show the new field length e.g. bizname string(55) unless I close and re-open the Database.

Any thoughts?
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Re: Lengthing string field

Postby Neosoft Support » Fri Apr 19, 2013 10:42 am

I don't know. Probably, the field information reported reflects the condition of the table when it was opened. Since the field's properties were altered via SQL, the database client doesn't know that field information has changed. You could try dbpRefresh, otherwise you will have to close and re-open the table. You shouldn't need to re-open the whole database - just the table.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Lengthing string field

Postby BRobinsonS » Sat Apr 20, 2013 7:08 am

Closing and opening the table worked.

Thanks again.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 340
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest