Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey guys

Is it possible changing a field size in SQL?
I created a table with a line called "description" with a field size of max. 20 characte. Now, I want to change this number into 30 but not by just entering this number in the properties of the field, I want to use SQL-Code.

Can anyone help me?


Greetings
Epanjohura
Posted

SQL
ALTER TABLE dbo.tableName
ALTER COLUMN description VARCHAR(30) NOT NULL
 
Share this answer
 
Comments
epanjohura 17-Dec-12 7:40am    
Thanks for your help.
I'll try it as fast as possible and mark your solution as accepted, if it helped me..
epanjohura 18-Dec-12 7:49am    
thank you so much, that really helped :)
SQL
ALTER TABLE [dbo].[Table Name]
ALTER COLUMN [Coloumn Name] [DataType Name ](Size Of Data Type u Want)NULL

 
Share this answer
 
v2
Comments
epanjohura 18-Dec-12 3:13am    
Thanks for your help.
I'll try it as fast as possible and mark your solution as accepted, if it helped me..
epanjohura 18-Dec-12 7:49am    
thank you so much, that really helped :)
Assuming you are using SQL server take a look at this link
SQL SERVER – Change Column DataTypes[^]
 
Share this answer
 
Comments
epanjohura 17-Dec-12 6:22am    
I'm not using SQL server
__TR__ 17-Dec-12 6:26am    
Then i would suggest you to tag your question properly with the database you are using.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900