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.
| Author |
Topic |
|
habuzahra
Starting Member
1 Post |
Posted - 2007-05-08 : 09:04:07
|
| Dear All i have a datetime field in the database which store the date and time in the following format : 2007-05-08 22:10:00i have the following query :select distinct users.userName, users.fullname, users.primaryemail, users.simulatedfrom dbo.users,dbo.AuditTrailwhere users.userid = AuditTrail.userid and AuditTrail.audittypeid =1 and AuditTrail.DateTime between '2007-04-25 00:00:00' and '2007-04-25 23:59:59'The Problem is that when i need to get the records any date i should write between '2007-04-25 00:00:00' and '2007-04-25 23:59:59'how i can make it to be like :where AuditTrail.DateTime= '2007-04-25' so i don't need to add the hours minutes and secondThanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-05-08 : 09:14:37
|
| select distinct users.userName, users.fullname, users.primaryemail, users.simulatedfrom dbo.users,dbo.AuditTrailwhere users.userid = AuditTrail.userid and AuditTrail.audittypeid =1 and AuditTrail.DateTime >= '20070425' and AuditTrail.DateTime < '20070426' Peter LarssonHelsingborg, Sweden |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-08 : 10:15:24
|
| http://sql-server-performance.com/fk_datetime.asp for more info on datesMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|