September 20, 2007 at 8:31 am
I have a column date(int) with values
75505
73637
74901
74105
73727
how can i find date range between 03/09/1998 and 09/12/2000
September 20, 2007 at 8:39 am
First thing we need to know is how the integer date value is computed. Looking at your data, I have no way of knowing what date 75505 (or any of the other values) represents.
September 20, 2007 at 8:41 am
No idea. You should first specify what the numbers in your INT column mean. The numbers you posted can mean anything - and I doubt anyone here has a functional crystal ball... but if you do, by all means let me know. It would be handy
September 20, 2007 at 8:43 am
Ok guys I got it by this
select
convert(char(10),cast(date - 36161 as datetime),101)from csuser.list
September 20, 2007 at 9:22 am
declare @startdate int,
@enddate int
set @startdate = datediff(dd, 0, '19980309') + 36161
set @enddate = datediff(dd, 0, '20000912') + 36161
select * from dbo.yourTable where date between @startdate and @enddate
September 20, 2007 at 10:37 am
Are you sure it's 36161, jp? That seems like a rather arbitrary date that isn't the beginning of any julian variation I'm aware of (it's 1800-12-30).
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply