473,763 Members | 9,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Counting number of selects made

COUNTING NUMBER OF SELECTS MADE


table mytable {
id, data, hits
}

users view data from the table:

SELECT data FROM mytable WHERE id=1 --for example
SELECT data FROM mytable WHERE id=20 --for example
....
How do increment the hits column without replacing the above with the below?

update mytable SET hits=hits+1 WHERE id=1;SELECT data FROM mytable WHERE id=1
update mytable SET hits=hits+1 WHERE id=1;SELECT data FROM mytable WHERE id=20
....
I believe triggers can't be used as they only trigger on update/delete events.

I'm using sql server 2000 (latest patches) with asp

Thanks
Alex
Jul 20 '05 #1
3 2174
There is no reliable way to do this. One option is to use the profiler to
track the SELECT statements and dump them into a file. This can be exported
in a SQL Server table later on.

--
- Anith
( Please reply to newsgroups only )
Jul 20 '05 #2
"Anith Sen" <an***@bizdatas olutions.com> wrote in message news:<M4******* **************@ bgtnsc05-news.ops.worldn et.att.net>...
There is no reliable way to do this. One option is to use the profiler to
track the SELECT statements and dump them into a file. This can be exported
in a SQL Server table later on.


I use stored procedures for everything. This is one reason why. You
can add auditting information whenever you like.

In a related story, I also have an USERID parameter on every stored
procedure for future use. (Then you can log who queried what).
Jul 20 '05 #3
A Seel (al*********@ho tmail.com) writes:
COUNTING NUMBER OF SELECTS MADE

table mytable {
id, data, hits
}
users view data from the table:
SELECT data FROM mytable WHERE id=1 --for example
SELECT data FROM mytable WHERE id=20 --for example
...
How do increment the hits column without replacing the above with the
below?


As Anith said, there is no supported way to this, other than to run a
Profiler trace.

Lumigent has a tool called Entegra, which they say will include a module
that audits who views which data. Their web site says that this module
is planned for release Q2, 2003, so one would expect it to appear soon.
See www.lumigent.com for more information.

--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6572
by: Victor Engmark | last post by:
When looking for a method to fetch unique elements and counting the number of occurences of each of them, I found quite a lot of gross examples of complex XSL. But after realizing the subtle difference between "." and "current()", I found a neat way of doing the same without keys or generate-id(): <xsl:template match="/"> <!-- Selects all "new" elements --> <xsl:for-each select="//Name"> <!-- Display the element -->
15
3618
by: parksch2 | last post by:
I've spent quite a bit of time (way more than I'd like) today looking for an answer to what I thought would be a simple question. I simply need to get the count of items within some nodes up to the current node (previous or previous-sibling related). For example, here is some sample XML I have to work with: <ITEM> <CHILD> <ITEM> <CHILD />
5
1280
by: rob.guitar.rob | last post by:
Hi, This may be a stupid question, but if you count a self axe will it always return 1? For example: count(self::*) and
3
1964
by: Megan | last post by:
hi everybody- i'm having a counting problem i hope you guys and gals could give me some help with. i have a query that retrieves a bevy of information from several different tables. first let me give you a little background. this database is kind of like a human resources database. it collects info about people, where they work, and if they have any work-related issues where they work.
18
2943
by: ChadDiesel | last post by:
I appreciate the help on this group. I know I've posted a lot here the last couple of weeks, but I was thrown into a database project at my work with very little Access experience. No other employee knows anything about Access. I've searched Google Groups, and that has been a lot of help, but there are some questions that I just can't find the answer to. I'll try to take it easy on the group after this question. I have one more...
1
6929
by: j | last post by:
Hi, I've been trying to do line/character counts on documents that are being uploaded. As well as the "counting" I also have to remove certain sections from the file. So, firstly I was working with uploaded MS WORD .doc files. Using code like that below: strLine = sr.ReadLine While Not IsNothing(strLine) 'Not eof If Trim(strLine) <> "" Then 'Not blank
1
8856
by: Jerry | last post by:
We have a 10-question quiz for kids, each question being a yes or no answer using radio selections. I'd like to keep a current total of yes's and no's at the bottom of the quiz (if the user selects yes to question 1, the total of yes's increases by 1). I've been searching for a while but I'm not sure I'm searching with the right keywords. Can anyone direct me to a source I can review to learn how to do this? Thanks! --
1
2278
by: oec.deepak | last post by:
Hi Cn any one telll me what is Reference counting in C++.
3
1514
by: nitric | last post by:
hey guys, i'm really stuck on this program. It's basically a survey and I have to ask people what drinks they like. 1-4, coffee tea oj and lemonade. i'm having trouble counting the TOTAL NUMBER OF PEOPLE and counting how many people pick coffee tea oj or lemonade. i have the 5th option set as a sentinel, where the program ends. i need help like i said counting the total number of people who participated(person who quits doesn't...
0
9564
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10148
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.