Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 30, 2012 03:40 PM by wavemaster
Participant
1289 Points
1127 Posts
Dec 30, 2012 01:55 PM|LINK
I am keeping track of how many times people watch a subset of my data.
Currently, at the appropriate time I read what the counter is, increment and then update the counter.
There must be a way to do this in one fell swoop.
Here is my attempt:
db.Execute("UPDATE Trips SET Views=Views ++ WHERE TripID=@1", TripID);
tried a few variations, no luck.
There must be a way to do this, elegantly.
1304 Points
313 Posts
Dec 30, 2012 02:37 PM|LINK
db.Execute("UPDATE Trips SET Views=Views +1 WHERE TripID=@1", TripID);
the ++ operator is not implemented in SQL_Server
Dec 30, 2012 03:40 PM|LINK
Thanks
wavemaster
Participant
1289 Points
1127 Posts
quick counter update - read & update at the same time?
Dec 30, 2012 01:55 PM|LINK
I am keeping track of how many times people watch a subset of my data.
Currently, at the appropriate time I read what the counter is, increment and then update the counter.
There must be a way to do this in one fell swoop.
Here is my attempt:
db.Execute("UPDATE Trips SET Views=Views ++ WHERE TripID=@1", TripID);tried a few variations, no luck.
There must be a way to do this, elegantly.
rrrsr7205
Participant
1304 Points
313 Posts
Re: quick counter update - read & update at the same time?
Dec 30, 2012 02:37 PM|LINK
db.Execute("UPDATE Trips SET Views=Views +1 WHERE TripID=@1", TripID);
the ++ operator is not implemented in SQL_Server
wavemaster
Participant
1289 Points
1127 Posts
Re: quick counter update - read & update at the same time?
Dec 30, 2012 03:40 PM|LINK
Thanks