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 |
|
Ish
Starting Member
11 Posts |
Posted - 2011-09-15 : 05:48:23
|
| HiI am new to creating database and tables.I am using Microsoft SQL Server Express 2008.I am using Microsoft SQL Server Management Studio GUI interface for design work.I have created few tables and it is working fine.I want to amend a field in one table ie change from nchar to int.When I try to do, it come with a message, I need to drop whole table and recreate. Is there any way of amending field without droping table. I have data in this table.Also it doesn't allow me to insert new column between columns.Please someone help.Many thanks |
|
|
karthik_padbanaban
Constraint Violating Yak Guru
263 Posts |
Posted - 2011-09-15 : 05:52:50
|
quote: Originally posted by Ish HiI am new to creating database and tables.I am using Microsoft SQL Server Express 2008.I am using Microsoft SQL Server Management Studio for design work.I have created few tables and it is working fine.I want to amend a field in one table ie change from nchar to int.When I try to do, it come with a message, I need to drop whole table and recreate. Is there any way of amending field without droping table. I have data in this table.Please someone help.Many thanks
alter table <table_name>drop column <column_name>GOalter table <table_name>add <column_name> datatype nullKarthikhttp://karthik4identity.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-15 : 05:58:34
|
| keep in mind that dropping the column will drop data as well.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-15 : 07:39:04
|
| Also it doesn't allow me to insert new column between columns.the position of column doesnt really matter at all as you can always retrieve them in order you want in select by specifying them in whatever position you want it to come------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|