dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

SQL Date Problem - sqlserver-faq

This is a discussion on SQL Date Problem - sqlserver-faq ; I am only just starting to use SQL as was using Access. I need to obtain records from a a few days previous (day varies) and would use Select * from Members Where Subscribed = Date() -4 Which would give ...



Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 01-02-2009, 11:46 AM
Database Newbie
 
Join Date: Jan 2009
Posts: 2
andrewharris is on a distinguished road
Default SQL Date Problem

I am only just starting to use SQL as was using Access.

I need to obtain records from a a few days previous (day varies) and would use
Select * from Members
Where Subscribed = Date() -4

Which would give me all new records from 4 days ago.

I need to do this is SQL but as its stores datetime i have a problem.

I have got as far as
SELECT MemberID, convert(varchar,Subscribed,103) as Subscribed
FROM dbo.Members

Which gives me just the date but not the records from 4 days etc

But dont know how to do the GetDate() version of date()
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 08:27 PM.