filter by time

G

g-fro

My stored procedure is below. I would like to be able to take the
delaydata.timestamp field and grab only the records during a certain
hour. How would I go about doing this? Currently I filter by Cell,
Date and User.

<************BEGIN STORED PROCEDURE *********>
ALTER PROCEDURE dbo.GetDelayData

@startDate as datetime,
@endDate as datetime,
@cell as nvarchar,
@user as nvarchar(20)

AS
SELECT *
FROM
DelayData
WHERE
(Convert(datetime,DelayData.TimeStamp) between @startdate and
(@endDate + 1))
and (DelayData.cell=@cell OR @cell='*')
and (DelayData.UserName=@user OR @user='*')
Order by Convert(datetime,DelayData.TimeStamp) ASC

<***********END PROCEDURE*******>

TimeStamp is the name of the field. I don't like the naming
conventions in this table but it is not a table created by me. I
would think this would be rather easy to do, but I haven't been able
to find any documentation on this.

Any help would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top