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
 General SQL Server Forums
 New to SQL Server Programming
 Greater than a date

Author  Topic 

AF
Starting Member

7 Posts

Posted - 2009-08-14 : 08:08:49
Hello.

I have a log of people calling an adviceline and I want to run a query that returns everyone who has called since a set date.

I've got a date colunm in a datetime format but can't figure out how to set a 'great than' parameter on it.

Any advice?

Thanks
Alex.

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-08-14 : 08:15:13
[code]
DECLARE @foo TABLE (
[ID] INT IDENTITY(1,1)
, [datestamp] DATETIME
)

INSERT @foo
SELECT '20090101'
UNION SELECT '20090201'
UNION SELECT '2009-03-01T23:34:02'

-- Every record where datestamp after 18th Jan 2009
SELECT * FROM @foo
WHERE
[dateStamp] > '20090118'
[/code]


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-08-15 : 03:12:22
you can create a procedure with query shown and having a parameter of datetime to pass the required date value.
Go to Top of Page

AF
Starting Member

7 Posts

Posted - 2009-08-20 : 12:18:12
Thanks very much - that did the trick!
Go to Top of Page
   

- Advertisement -