[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Datediff question. (3)
- Subject: Re: Datediff question. (3)
- From: Tim Green <Tim_Green@MERCER.COM>
- Date: Thu, 19 Nov 1998 11:46:06 -0600
Well that's truly peculiar. I'm not using an identical platform, but this works
for me. I modified the sample you provided since I don't have a similar
database, and it worked fine under SQR 3.0.5 and 4.0.2. We're using Sybase 11.0
and SQR is using it's native Sybase drivers.
I suspect this is an ODBC issue. Have you talked to tech support? Does
Microsoft still support DBLib in SQL Server 6.5? If so, you should be able to
test SQR using DBLib connectivity and see if it works then.
Good luck and sorry I can't be of any help,
Tim Green Tim_Green@mercer.com
Administrative Solutions Group
An ADP/Mercer Alliance
P.S. Here's the example I used:
begin-program
do finddt
end-program
begin-procedure finddt
begin-select
getdate() &currdate
'9/16/1969' &dob
Move &dob To $dob
Move &currdate To $currdate
Do printdiff
end-select
end-procedure
begin-procedure printdiff
begin-select
DATEDIFF(yy, $dob, $currdate) (+3,1)
end-select
end-procedure
>
> Tim,
>
> I'm not working with a local procedure, see below an example:
>
> begin-program
> do finddt
> end-program
>
> begin-procedure finddt
> begin-select
> Max(WO.REPORTDATE) &maxrepdate (+1,1)
> Min(WO.WONUM) &firstwo (+1,1)
>
> Move &firstwo To $firstwo
> Move &maxrepdate To $maxrepdate
> Do printdiff
> From WORKORDER WO
> end-select
> end-procedure
>
> begin-procedure printdiff
> begin-select
> DATEDIFF(day, WO2.REPORTDATE, $maxrepdate) (+3,1)
>
> From WORKORDER WO2
> Where WO2.WONUM = $firstwo
> end-select
> end-procedure
>
> My database is SQL Server 6.5 with SQR3 for ODBC under Windows 95.
>
> Thanks a lot.
>
> Romeu F. Sciotta
> MIPS Sistemas (PSDI var in Brazil)
>
> >
> >Are you using this query from within a local procedure and is the
> variable in
> >question global? If so, you need an underscore after the
> dollar sign $
> in the
> >variable reference. And as someone else pointed out, I
> don't believe an
> &
> >variable reference will work.
> >
> >Perhaps if you provided a little more code and information about your
> platform
> >we could help more.
> >
> >Good luck,
> >Tim Green
> Tim_Green@mercer.com
> >Administrative Solutions Group
> >An ADP/Mercer Alliance
> >
> >
> >> Anthony,
> >> I tried to use an alphanumeric variable and it didn't work.
> >>
> >> Thank you for your tips.
> >>
> >> If anyone have a new tip, I'll be grateful.
> >>
> >>
> >> Romeu F. Sciotta
> >> MIPS Sistemas (PSDI var in Brazil)
> >>
> >> >
> >> >Hi Romeu,
> >> >
> >> >Datediff is SQR function not a database function. You can
> >> use it in your
> >> >LET, IF, WHILE command. You can not this function as part
> of select
> >> column
> >> >list.
> >> >
> >> >Raj
> >> >
> >> > -----Original Message-----
> >> > From: Romeu Sciotta [SMTP:tb09@PETROBRAS.COM.BR]
> >> > Sent: Tuesday, November 17, 1998 2:25 PM
> >> > To: Multiple recipients of list SQR-USERS
> >> > Subject: Datediff question.
> >> >
> >> > From: NAME: Romeu Finoti Sciotta
> >> > FUNC: DTSE/SUPER/DITEP/SETEC <TB09@A1@C60000>
> >> > To: NAME: SQR UserGroup
> <SMTP%"SQR-USERS@usa.net"@mrgate>
> >> >
> >> > Hello to all.
> >> >
> >> > When I try to put a variable into datediff command on
> >> begin-select
> >> > paragraph, I receive the following message:
> >> >
> >> > (SQR 1303) Error in SQL (perhaps missing &name after
> >> expression):
> >> > select DATEDIFF(day, WO.REPORTDATE, ?) From
> >> WORKORDER WO Where
> >> >WO.WONUM =
> >> > '15485'
> >> > (SQR 1304) Check SELECT columns, expressions and
> >> 'where' clause
> >> for
> >> > syntax.
> >> >
> >> > Where is "?" I'm using a variable (ex: &dateinit)
> >> > My question is: Doesn't SQR support variables
> into DATEDIFF
> >> command?
> >> > Obs.: I've tried to use this command directly on
> SQL and it
> >> worked.
> >> >
> >> > Any help would be appreciate.
> >> > Thank's in advance.
> >> >
> >> > Romeu F. Sciotta
> >> > MIPS Sistemas (PSDI var in Brazil)
> >> >
> >> > Inf: SQR v3 for ODBC
> >>
>