SnippetCollection
Forums  
Links
 
Support
 


snippetCollection.com Forum Index FAQ Memberlist Search Usergroups Profile Log in to check your private messages Log in Register
Welcome to SnippetCollection.com, a friendly and fast growing community of programmers, coders, web application developers and more. You are currently viewing our forums as a guest!

This message will go away once you are registered. Also, by registering you will have access to all post topics, communicate privately with other members (PM), respond to polls and access other special features. Registration is fast, simple and absoultely free so please Click Here to join our community

Enjoy our great collection of snippets and tutorials!

Log in
Username:
Password:

 

Our Sponsors
           
Want to list your business here. Contact us.
 Getting Records Before Date/Time View next topic
View previous topic
Post new topic Reply to topic
Author Message
crashed



Joined: 12 Sep 2005
Posts: 156
Location: England

PostPosted: Thu Apr 06, 2006 10:16 pm Reply with quoteBack to top

Hi all,

Im trying to get all the records from a table before a certain Date/Time.

The field is in the MSSQL 2005 datetime format.

The sql i have at present which is returning every record in the database is:

Code:
SELECT [logintime] FROM security WHERE ([lTime]<'01/02/2006 11:11:11')


All help appreciated as this is kinda urgent

Rgds,
Crashed


Last edited by crashed on Fri Apr 07, 2006 3:26 am; edited 1 time in total
crashed



Joined: 12 Sep 2005
Posts: 156
Location: England

PostPosted: Fri Apr 07, 2006 3:25 am Reply with quoteBack to top

Ok, i managed to fix this a couple of hours ago but have been implementing the entire service so have not had time to post until now.

Heres the correct SQL:

Code:
SELECT logintime FROM security WHERE ([lTime]<= CONVERT(datetime,'" + oldTime.ToString() + "', 103))


This code allows you to select records older then oldTime
Display posts from previous:      
Post new topic Reply to topic


 Jump to:   



View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme
All times are GMT