0

i need to retrieve data from sql server database using date attribute as shown below

SELECT OracleId,FirstName,MiddleName,CoachGroupName 
FROM viewDailyAttendanceInfo where  Createddate = '4/14/2014 ';

but, nothing data will be generate, even if the record is found in the DB

Note:- the data type of createddate is datetime.

David Brabant
  • 41,623
  • 16
  • 83
  • 111
Sapna
  • 53
  • 10

1 Answers1

0

Firstly there is a space in your Date String at the end '4/14/2014 '.

Try removing that space, if that doesn't work try using greater than (>) and less than (<) operators on the date, something like:

SELECT OracleId,FirstName,MiddleName,CoachGroupName FROM viewDailyAttendanceInfo where      Createddate >= '4/14/2014' and Createddate < '4/15/2014';

But my guess is that it's because of the space in your date.

rafal
  • 13
  • 4
  • dear, its not working. and i need to have only one date parameter. – Sapna Apr 21 '14 at 15:26
  • Have a look at this: http://stackoverflow.com/questions/11955281/sql-where-datetime-column-equals-todays-date – rafal Apr 21 '14 at 15:47