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 |
MagicCity77
Starting Member
19 Posts |
Posted - 2008-09-30 : 10:14:29
|
Helo all,I would like to know how do you clear the content of a single column.Here is the script that I thought I could use to implement this.ALTER TABLE tb_Main ALTER COLUMN Ext set NULL I want to be able to go back and clear out the Extension for the Ext column. |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-09-30 : 10:20:03
|
update tb_main set Ext = NULLBe One with the OptimizerTG |
 |
|
CodesMyBusiness
Starting Member
9 Posts |
Posted - 2008-09-30 : 10:21:11
|
If you want to 'clear' the value of a column, all you need to do is SET the value.Example:UPDATE tb_Main WITH (ROWLOCK) SET Ext = NULL |
 |
|
MagicCity77
Starting Member
19 Posts |
Posted - 2008-09-30 : 10:47:27
|
Wow, that's it????ThanksI have so much more to learn. |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-30 : 10:55:33
|
The suggested methods clear complete column for all records.If you only want to clear the column for some records, use a WHERE clause.UPDATE Table1SET Col1 = NULLWHERE Col2 = 'USA' E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|