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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Best way to keep counter data

Author  Topic 

melberti
Starting Member

10 Posts

Posted - 2004-09-29 : 16:44:12
I have been asked to keep a count for each of three randomly-served images that point people to a particular funcionality on a web site. Because the site is housed on a web farm of 5 server, I figure the best way to do this might be to store the counts in a database (as opposed to keeping an application variable). I'm thinking that it's probably NOT ideal to query for the current count value, add one to it, and update it every time I need to update an individual data count. It also seems NOT ideal to create three different tables that are empty except for an autonumber field that gets updated due to insert statements... Can anyone think of a good way to keep these counts? I thought maybe it would be a good use for a trigger (my first) but after doing a little research I think not.

Any input would be appreciated.

nr
SQLTeam MVY

12543 Posts

Posted - 2004-09-29 : 17:49:33
Your query would be something like
update tbl set cnt = cnt + 1 where val = 'image1'
You don't "query for the current count value, add one to it, and update it every time"

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -