Using Dreamweaver/Vb/Access. Wanting to count how many times a user has made an entry to a forum and since the page is dynamic I have to do the count based on user session (id)
"sunitabeck" suggested I created a stored procedure with a parameter (such as @UserId) and then call that stored procedure from the client code, passing in the userId of the user who is viewing the page.
Only problem is I'm quite new to SQL. Thinking I have to call it in the WHERE clause, just not sure how.
The SP is called with the parameter and it returns the count.
The SP would be something like create proc s_CountUserEntries @UserID int , @count in out as select @count = count(*) from ForumPosts where UserID = @UserID go
then call it with
declare @Count int declare @UserID int select @UserID = MyUserID ... exec s_CountUserEntries @UserID = @UserID, @Count = @Count int out select @Count
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.
The SP is called with the parameter and it returns the count.
The SP would be something like create proc s_CountUserEntries @UserID int , @count int out as select @count = count(*) from ForumPosts where UserID = @UserID go
then call it with
declare @Count int declare @UserID int select @UserID = MyUserID ... exec s_CountUserEntries @UserID = @UserID, @Count = @Count int out select @Count
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.
small typo fixed
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
I'm trying to twist my head around this but I can't get it to work. Thought it might be easier. Dreamweaver is throwing all kinds of errors and that is probably because I've never created a SP before and used it later in a recordset.
What is the absolute easiest way to do this? Have to start at the bottom on build my way up in order to understand.