Monday 11 April 2011

DDL : Modifying a Colunm

With Sybase 12.1.X and higher, a column type can be altered. You need to be dbo and have select into turned on, in the database defaults.

create table employee (
emp_id integer not null,
salary money default 0,
hire_dt datetime default getdate(),
last_name varchar(5) null
)
go


/* make the name column longer */
alter table employee modify last_name varchar(80) not null
go


/* rename the column (works with Sybase 11 and 12) */
sp_rename 'employee.last_name',last_nm
go

No comments:

Post a Comment