Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Alter column precision

Author  Topic 

mb
Starting Member

16 Posts

Posted - 2002-06-19 : 07:22:55
Does any know the systax for modifying a column precision say from 30 to 100.

On oracle I would use

Alter table tablename modify ( columnName varchar(100))

but this doesnt seem to work on sql server.

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2002-06-19 : 07:35:06
From SQL Books On-Line:

ALTER TABLE table
{ [ ALTER COLUMN column_name
{ new_data_type [ ( precision [ , scale ] ) ]
[ COLLATE < collation_name > ]
[ NULL | NOT NULL ]
| {ADD | DROP } ROWGUIDCOL }
]
.....

Edited by - YellowBug on 06/19/2002 07:35:36
Go to Top of Page

mb
Starting Member

16 Posts

Posted - 2002-06-19 : 07:38:47
That seems to insinuate that this should work:

alter table zzcompanycontact alter UserName varchar(100) null

However it throws back this error

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'UserName'.

Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2002-06-19 : 07:43:18
That should read:

alter table zzcompanycontact alter COLUMN UserName varchar(100) null

You are missing the keyword COLUMN

Go to Top of Page

mb
Starting Member

16 Posts

Posted - 2002-06-19 : 07:48:51
Doh!

Cheers yellow bug

Go to Top of Page
   

- Advertisement -