all groups > sql server (alternate) > january 2005 >
You're in the

sql server (alternate)

group:

Any easy way to change column length like varchar 30 to varchar 100?



Any easy way to change column length like varchar 30 to varchar 100? sdowney717 NO[at]SPAM msn.com
1/31/2005 7:05:21 AM
sql server (alternate):
I would like to increase the length of the column from
LOCNumber VARCHAR(30) DEFAULT ''

to
LOCNumber VARCHAR(100) DEFAULT ''

without losing any data currently stored in the field.


And it has an index on it defined as
CREATE INDEX LOCIndex ON BookData(LOCNumber)

Thanks for any help.
Re: Any easy way to change column length like varchar 30 to varchar 100? sdowney717 NO[at]SPAM msn.com
1/31/2005 9:28:33 AM
That works well, thanks very much
Do you know how to do this with MySQL as well?
Re: Any easy way to change column length like varchar 30 to varchar 100? sdowney717 NO[at]SPAM msn.com
1/31/2005 9:43:11 AM
Found it, you use this
ALTER TABLE BookData MODIFY COLUMN LOCNumber varchar(100)
Re: Any easy way to change column length like varchar 30 to varchar 100? Hugo Kornelis
1/31/2005 4:24:08 PM
[quoted text, click to view]

Hi sdowney,

Just use ALTER TABLE:

ALTER TABLE BookData
ALTER COLUMN LOCIndex varchar(100)

No need to re-specify the default - it won't be changed.

Best, Hugo
--

AddThis Social Bookmark Button