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 2008 Forums
 SQL Server Administration (2008)
 modifying columns

Author  Topic 

akashenk
Posting Yak Master

111 Posts

Posted - 2010-10-25 : 12:39:45
How do I go about changing column names and modifying column datatypes in SQL Management studio 2008? When I try to, it tells me I will lose all my data in the column since the table has to be recreated. Since when are tables recreated when a column is changed? In previous versions of SQL Server, I was able to rename columns with no effect. I was also able to change the datatype, and only recieved warnings about data possibly being truncated.

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-10-25 : 13:06:59
ALTER TABLE ALTER COLUMN <column name> <data type>;
Go to Top of Page

akashenk
Posting Yak Master

111 Posts

Posted - 2010-10-25 : 21:02:45
thaks for the reply, but I wasn't looking fos T-SQL script. This is built-in functionality in SQL Management Studio... at least it used to be :)
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-10-25 : 21:11:31
it still is. you should be using t-sql anyway.
Go to Top of Page

akashenk
Posting Yak Master

111 Posts

Posted - 2010-10-26 : 00:21:52
hmmm. then I wonder why mine's not working. Do you have any idea?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-10-26 : 02:18:03
Script the change in SSMS and see what the script is doing. Maybe something else unexpected is changing too.
Go to Top of Page
   

- Advertisement -