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 |
|
dlmagers10
Starting Member
48 Posts |
Posted - 2010-10-27 : 10:05:45
|
| OK, TRYING TO UPDATE [MODIFY] AN EXISTING TABLE NONAPPLIANCEHERE IS MY STATEMENT:ALTER TABLE NONAPPLIANCEMODIFY DESCRIPTION CHAR(30);IT IS GIVING ME AN ERROR:Msg 102, Level 15, State 1, Line 2 Incorrect syntax near 'MODIFY'.WHAT AM I DOING WRONG? |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-10-27 : 10:19:59
|
quote: ALTER TABLE NONAPPLIANCEAlter column DESCRIPTION CHAR(30);
|
 |
|
|
dlmagers10
Starting Member
48 Posts |
Posted - 2010-10-27 : 10:25:39
|
| Thank you. |
 |
|
|
dlmagers10
Starting Member
48 Posts |
Posted - 2010-10-27 : 11:34:17
|
| Ok, I would like to ask you this if I may,On another database I created a table named FICTIONand the table looks like this:CREATE TABLE FICTION (BOOK_CODE CHAR(4) PRIMARY KEY, TITLE CHAR(40), PUBLISHER_CODE CHAR(3), PRICE DECIMAL(4,2) );Now I am trying to change the data type in TITLE to CHAR(50)ALTER TABLE FICTIONMODIFY COLUMN TITLE CHAR(50);I am getting an error again:Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'COLUMN'.My question is do I need to REFRESH something? |
 |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-10-27 : 12:29:30
|
Existing column alter syntax is:Alter table <tableName>Alter column <ColumnName> <Datatype with length>ALTER TABLE FICTIONMODIFY ALTER COLUMN TITLE CHAR(50); |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2010-10-27 : 15:05:26
|
| Modify is not part of the Alter table syntax. Please consult the SQL Books Online for what the valid syntax is.--Gail ShawSQL Server MVP |
 |
|
|
|
|
|
|
|