Source language: Translate to:

Sql to increase column size

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Sql to increase column size

Postby BRobinsonS » Sat Jun 17, 2017 7:28 am

I have a field in a couple tables of ProvState String(2) .
I have a request from Australia that a user needs at least String(3).
I would like to alter the field/column size to String(5) for existing databases using SQL in the code.

What would be the correct syntax using Neobook and DBPro?
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: Sql to increase column size

Postby Gaev » Sat Jun 17, 2017 8:17 am

Brian:

Slightly different syntax depending on server brand ... details here ... http://www.1keydata.com/sql/alter-table ... olumn.html
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Sql to increase column size

Postby Rasl » Sat Jun 17, 2017 8:22 am

dbpExecSQL "DATABASE" "[sql]" ""

[sql]
SQL Server / MS Access:

ALTER TABLE table_name ALTER COLUMN ProvState varchar(5);


My SQL / Oracle (prior version 10G):

ALTER TABLE table_name MODIFY COLUMN ProvState datatype;

Oracle 10G and later:

ALTER TABLE table_name MODIFY ProvState datatype;

salu2
Rasl
 
Posts: 129
Joined: Sat Apr 02, 2005 8:25 am
Location: Buenos Aires, Argentina

Re: Sql to increase column size

Postby BRobinsonS » Sat Jun 17, 2017 9:10 am

I am using the AccessDB of DBPro.
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: Sql to increase column size

Postby Gaev » Sat Jun 17, 2017 10:31 am

Brian:

I am using the AccessDB of DBPro.


As per ... https://msdn.microsoft.com/en-us/librar ... =office.12).aspx ...
Code: Select all
ALTER TABLE {your Table Name here} ALTER COLUMN {your Field Name here} TEXT(5)
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Sql to increase column size

Postby BRobinsonS » Sat Jun 17, 2017 11:21 am

Thank you.
It works.
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 0 guests