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 |
|
miked1978
Starting Member
25 Posts |
Posted - 2008-08-26 : 08:03:10
|
| Hey guys. I'm somewhat of a beginner in SQL and am having problems with my code.I have a table named step5 and have about 12 columns with data. Two of those columns i just created and need to populate them with data that comes from the other columns. The 2 columms I created are called Ahead and Behind. Ahead needs to be populated from the SVc column if the value in SVc is greater then 0.Behind needs to be populated from the SVc column if the value in SVc is less then 0.Can anyone help me out< |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-26 : 08:12:45
|
[code]update step5set Ahead = SVc where Svc > 0update step5set Behind = SVc where Svc < 0[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
miked1978
Starting Member
25 Posts |
Posted - 2008-08-26 : 08:16:00
|
quote: Originally posted by khtan
update step5set Ahead = SVc where Svc > 0update step5set Behind = SVc where Svc < 0 Wow that was simplier then I thought. Thanks!!! KH[spoiler]Time is always against us[/spoiler]
|
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-26 : 08:28:44
|
or you can do it in one passupdate step5set Ahead = case when SVc > 0 then SVc else NULL end, Behind = case when SVc < 0 then SVc else NULL end [/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-26 : 08:29:36
|
or do it in a single updateupdate step5set Ahead = case when Svc > 0 then SVc else Ahead end,Behind =case when Svc < 0 then SVc else Behind end |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-26 : 08:33:04
|
Madhi deleted his post and i got this while opening the threadquote: ADODB.Field error '800a0bcd'Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record./forums/post.asp, line 333
KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-26 : 08:33:26
|
|
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-26 : 08:35:55
|
quote: Originally posted by khtan Madhi deleted his post and i got this while opening the threadquote: ADODB.Field error '800a0bcd'Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record./forums/post.asp, line 333
KH[spoiler]Time is always against us[/spoiler]
There was a problem while postingThe post didnt show my reply so I deleted it MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|