[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] RE: SQL Null date (McCown, Larry)



The problem is, as mentioned earlier, that the strings $month and $year, are 
being passed to the RDBMS, not their values.  The correct syntax for your IF 
statement would be as follows:

if isnull(&targstartdate3)
   let $where5 = 'and datepart(MM,reportdate) = ''' || $month ||
                 ''' and datepart(YYYY,reportdate) = ''' || $year || ''''
else
   let $where5 = 'and datepart(MM,targstartdate) = ''' || $month ||
                 ''' and datepart(YYYY,targstartdate) = ''' || $year || ''''
end-if

...........

And by the way folks, datepart() is a database function, NOT and SQR 
function.



_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users