I have a table with two columns one is the date and one is the time so for example one records date might be '06/20/08' and its time might be '08:52:32:140'. I need a stored procedure to return back the counts of another field where the date and time is later than some date/time input parameter. Here is my erroneous code and I think all that needs to be fixed is the WHERE clause. Any ideas how to do that?
Also, this may be the wrong place to post this question but I'll give it a go. The SortLane field is limited to certain values (between 1 and 9) so it will output something like this when I execute the procedure.
SortLane Total
4 2
5 2
8 2
9 14
Does anyone have some example code as to how to get data into a piece of vb.net code?
Thanks
Also, this may be the wrong place to post this question but I'll give it a go. The SortLane field is limited to certain values (between 1 and 9) so it will output something like this when I execute the procedure.
SortLane Total
4 2
5 2
8 2
9 14
Does anyone have some example code as to how to get data into a piece of vb.net code?
Thanks
Code:
CREATE PROCEDURE [dbo].[Sorter_Counts]
-- Add the parameters for the stored procedure here
(@ResetTime [nvarchar] (50),
@ResetDate [nvarchar] (50))
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT SortLane, COUNT(SortLane) as total
FROM Archive_Table
WHERE SortDate > @ResetDate AND SortTime > @ResetTime
GROUP BY SortLane
ORDER BY SortLane ASC
END