Re: Number to Date.

From: JI (anonymous_at_discussions.microsoft.com)
Date: 04/06/04


Date: Tue, 6 Apr 2004 14:17:21 -0400

create table testDate(DateNumber int)
go

insert into testDate
Select 20040101
Union
Select 20040201
Union
Select 20040301
Union
Select 20040401

go
Select DateNumber
  from testDate
where convert(datetime,convert(varchar,DateNumber)) <
DateAdd(day,-45,getdate())

"Dylan" <anonymous@discussions.microsoft.com> wrote in message
news:1848e01c41b1e$9d82cb60$a301280a@phx.gbl...
> Hi,
>
> The accounts package that we use uses MSSQL for its
> database. One of the tables is for recording sales
> transactions. The due date field in this table is stored
> as INT size 4 in the YYYYMMDD format; i.e 20040405
> (today's date). I have been asked to create a script
> that will report all transactions that are x numbers past
> their due date from a specified date. So they might want
> to find out all transactions that will be 45 days overdue
> (past due date) as of the end of the month, for example.
> My problem is finding a way to convert this due_date
> filed to date format so that the date they enter can be
> deleted from it. Can anyone help?
>
> To recap:
>
> Convert 20040405 (INT) to 20040405 (YYYYMMDD - date)
>
> TIA,
>
> Dylan