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
 General SQL Server Forums
 New to SQL Server Programming
 Need Query for Modify Column Type

Author  Topic 

amirmuthu
Starting Member

12 Posts

Posted - 2008-03-10 : 06:47:22
Hello Experts,
Can any one tell me the query to modify the existing Column character length using QUERY?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-03-10 : 06:50:32
use the alter table . . alter column
see http://msdn2.microsoft.com/en-us/library/ms190273.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-03-10 : 06:51:55
do you mean changing that actual datatype? i.e. ALTER TABLE...

or changing the data in that column? ...with a substring() function?

or both?

Em
Go to Top of Page

ranganath
Posting Yak Master

209 Posts

Posted - 2008-03-10 : 06:55:02
Hi,

ALTER TABLE TableName ALTER COLUMN ColumnName Datatype
Go to Top of Page

amirmuthu
Starting Member

12 Posts

Posted - 2008-03-10 : 06:59:24
Yes, changing the Actual data type

for example : emp.ename varchar(10) is need to be change into emp.ename varchar(20) using query.

Got it?

Thanks for your time
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-03-10 : 07:00:28
Got it. Use the ALTER TABLE . . . ALTER COLUMN as shown by ranganath. Also refer to the BOL or the link that i provided for detail syntax


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

amirmuthu
Starting Member

12 Posts

Posted - 2008-03-10 : 07:02:00
quote:
Originally posted by ranganath

Hi,

ALTER TABLE TableName ALTER COLUMN ColumnName Datatype



Ranganath,

Thank you so much.its working fine
Go to Top of Page
   

- Advertisement -