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 2000 Forums
 Transact-SQL (2000)
 Replace Column

Author  Topic 

Maher
Starting Member

1 Post

Posted - 2004-08-14 : 16:19:58
Hello sir's

in tables i have one table for items , in this table there is wrong data in on column so i need to replace this column and insert anather with new data.

plz how can i do?

thank for all team

Maher

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-08-14 : 19:44:41
ALTER TABLE tablename DROP columnname

--This will drop the bad column.

ALTER TABLE tablename ADD columnname VARCHAR(50)

--This will add a new column. You need to replace VARCHAR(50) with whatever type of column you need.

You really should buy a Transact-SQL Book if you don't know this kind of thing. You can also look in Books Online. It answers all the question and more. It's free. For a list of books, look here:

http://www.sqlteam.com/store.asp

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-08-15 : 08:04:55
You don't mean you jsut want to RENAME the name of the column do you? You can do that from Enterprise Manager or with the SQL command sp_rename

Kristen
Go to Top of Page
   

- Advertisement -