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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Date Funny

Author  Topic 

Scott
Posting Yak Master

145 Posts

Posted - 2002-01-23 : 03:53:22
I have the following:

DECLARE @StartDate smalldatetime
DECLARE @EndDate smalldatetime
SELECT @StartDate = '20010101'
SELECT @EndDate = '20020610'

....

where (PayDate between @StartDate and @EndDate)

I get no results but the following gets results:

where (PayDate between '20010101' and '20020610')

Whats the difference??
Confused?

nr
SQLTeam MVY

12543 Posts

Posted - 2002-01-23 : 04:12:18
Try
where (PayDate between convert(smalldatetime,'20010101') and convert(smalldatetime,'20020610'))





==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -