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.
| Author |
Topic |
|
khusiie
Yak Posting Veteran
78 Posts |
Posted - 2008-07-24 : 09:13:11
|
| hi folks,create table testphone1 char(21) not null,phone2 char(21) not nullgonow i have to modify the width to 10i wantphone1 char(10) not null,phone2 char(10) not nullaso how can i get with alter table..can anyone help me..thanks |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-07-24 : 09:22:57
|
| Alter table tablename Alter column columnname char(10) |
 |
|
|
khusiie
Yak Posting Veteran
78 Posts |
Posted - 2008-07-24 : 09:27:59
|
| i did same..but it gives me error like:String or binary data would be truncated.The statement has been terminated.what should i do?thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-24 : 09:32:17
|
quote: Originally posted by khusiie i did same..but it gives me error like:String or binary data would be truncated.The statement has been terminated.what should i do?thanks
This is because you've some data in your table which is more than 10 characters long. either truncate the existing data in table and alter column width or update the column data to retain only first 10 characters and then alter, depending on what you want. but certainly with some data having length >10 characters you cant alter it to have only a max length of 10 |
 |
|
|
|
|
|