Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Types

Status
Not open for further replies.

darude

Programmer
Jun 23, 2003
138
US
Good evening,
Would appreciate any feedback and thank you in advance. How do you change the data type in a SQL Server table. I seem to be able to change the data type, but can't save the changes.

Thank you
Lisa
 
Unfortunately, your question doesn't make sense. Can you please provide more information.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
If order to change the datatype of a column you have to create a new table with a new name with the new column data type, then copy all the data into the new table. After the data has been copied drop the original table, create the indexes using the original names and rename the table to the name of the original table.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Thanks for the answers. Now, after I changed the data type in the column I realized I needed to refresh and then I would see the changes. So, is it wrong to just select modify table and change the data type that way?
 
>> So, is it wrong to just select modify table and change the data type that way?

No, there's nothing wrong with doing it that way.

The process that mrdenny describes occurs auto-magically for you by Enterprise Manager when you modify the data type. If you wanted to write a T-SQL script to do this, then mrdenny's advice would be the way to do it.

Make sense?

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
It does, thank you. Just wanted to know I was doing right.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top