I have a SQL server table that has a date field in it called LOADDATE. In the description of the column in SQL Server it says LOADDATE (date, not null)
When I have a DEFINE using the DOWK(LOADDATE, 'A4') I get blanks returned.
When I just report out the LOADDATE field I get 2016/08/29
When I substitute &YYMD in DOWK(&YYMD, 'A4') then MON is returned as it should be.
When I report out &YYMD by itself I get the date in the 2016/08/29 format.
So why if the two fields have the same format does the DOWK(LOADDATE, 'A4') not work?
Thanks TrudyThis message has been edited. Last edited by: Trudy,
DOWK expects the date in legacy I8YYMD format (like &YYMD). Your LOADDATE will be defined as a SmartDate in the FOCUS synonym. Try this to print the day of week for a SmartDate:
TABLE FILE xxxx PRINT LOADDATE/WT . . END
The PRINT LOADDATE/WT did give me the day of the week but I want to filter on that value so I was looking more for a DEFINE way of getting to the day of week. Sorry I should have made that clearer in the original post.
You could probably save yourself some trouble and use a SQL Server function
DEFINE FILE xxxx DOW/A10 WITH yyyy = DB_EXPR( DATENAME( dw, START_DATE ) ); $ END
It will be the full weekname in mixed case, but you can probably work with that. And there is no fear that it will not be translated.
"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
Got what I needed by creating a define with the following
DOWK(DATECVT(LOADDATE, 'YYMD', 'I8YYMD'), 'A4')
Thanks for all the help!
|Powered by Social Strata|