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 |
|
darenkov
Yak Posting Veteran
90 Posts |
Posted - 2007-11-18 : 06:50:50
|
I am having trouble incrementing a column value. The code seems basic but doesn't work.ALTER PROCEDURE [dbo].[prc_UpdateVotes] @OptionID intASBEGIN SET NOCOUNT ON;DECLARE @NumberOfVotes intSET @NumberOfVotes = (SELECT Votes FROM PollOptions WHERE OptionID = @OptionID)UPDATE PollOptionsSET Votes = (@NumberOfVotes + 1)WHERE OptionID = @OptionID |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-18 : 07:18:03
|
[code]UPDATE PollOptionsSET Votes = (isnull(@NumberOfVotes, 0) + 1)WHERE OptionID = @OptionID[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
darenkov
Yak Posting Veteran
90 Posts |
Posted - 2007-11-18 : 07:44:06
|
| thanks |
 |
|
|
|
|
|