hey all,
how would i clear values for a column for all rows but not delete the row?
thanks,
rodcharHi,
Use Update command and set the column value with null
UPDATE TABLE
SET COL1 = NULL
Thanks
Hari
SQL Server MVP
"rodchar" wrote:
> hey all,
> how would i clear values for a column for all rows but not delete the row?
> thanks,
> rodchar|||"Clear" meaning what' You have to decide, for each datatype (for each
Column) what value will mean "Cleared" For a chacacter type column that's
not hard, Just an Empty String, I guess makes the most sense, but for
numeric or date columns, it's bit harder, The value you choose may be a
meaningful value in rows that are not "Cleared"
If the Columns allow Nulls, you could use null, but that's not really what
null iod supposed to be for, (it means UNKNOWN) so I wouldn;t recommend that
,
(UNless you MEAN Unknown when you say "CLeared")
"rodchar" wrote:
> hey all,
> how would i clear values for a column for all rows but not delete the row?
> thanks,
> rodchar|||You can do:
--if column is defined as nullable
update tb
set col=null
-oj
"rodchar" <rodchar@.discussions.microsoft.com> wrote in message
news:D8369B7B-3634-4A8B-88FC-23D948D18D53@.microsoft.com...
> hey all,
> how would i clear values for a column for all rows but not delete the row?
> thanks,
> rodchar
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment