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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UpDate Table column 2

Status
Not open for further replies.

wg26

Programmer
Mar 21, 2002
135
US
Hi Everyone:

I have add one column into my table and I want to set the value of this column based on another column in the table,and the following is the code how I do it...but it didn't seem to work...and Can anyone kindly take a look my code and let me know what is wrong? Thanks alot

Declare @DetailName varchar(50)
UpDate #TempTable
Set [Detail Name] = @DetailName
select @DetailName = case when [Flavor] = '1' then 'Apple'
when [Flavor] = '2' then 'Orange'
When [Flavor] = '3' then 'pear'
End
From #TempTable
 
UpDate #TempTable
Set [Detail Name] =
case when Flavor = '1' then 'Apple'
when Flavor = '2' then 'Orange'
When Flavor = '3' then 'pear'
end
 
Hi,

Try this code.....

UpDate #TempTable
Set [Detail Name] = case [Flavour] when '1' then 'Apple'
when '2' then 'Orange'
When '3' then 'pear'
End



Hope this is wht u r looking for..........
Sunil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top