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 2005 Forums
 Transact-SQL (2005)
 Tracking searches.

Author  Topic 

wndrboy2k3
Starting Member

37 Posts

Posted - 2008-05-10 : 02:37:10
Hey everybody,

First thank you for all your help thus far. Now I'm stuck again. I've been doing a lot of reading on triggers and logging information into tables but I've been trying to capture how many times someone enters an item into the search box.

So every time somebody types Gumballs into the search box I want to capture it and the name of the person who is currently logged in. Is there away to do this? Maybe this is something that I should be checking in ASP.NET forums?

Thanks in advanced guys!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-10 : 02:48:45
You can do this. You can keep a log table in SQL and pass the value of textbox string (Gumballs) to db and use a INSERT statement to insert this to log table. Something like

INSERT INTO LogTable (SearchString,UserName,DateLogged)
SELECT @String,SUSER)_SNAME(),GETDATE()

you can put it in a stored procedure and pass @String value from textbox in ASP.NET. ALternatively you can directly use this as an inline query by getting value from ASp.NET itself.

And to capture howmany times a search string was entered you can use this.

SELECT SearchString,COUNT(*)
FROM LogTable
GROUP BY SearchString


Also refer this:-

http://www.developerfusion.co.uk/show/4278/2/
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-05-10 : 05:39:56
Worth considering how you are going to index this table , because if there are substantial rows , searching gets slow

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page
   

- Advertisement -