Hi rrjegan17
The function is written in sql and then a view is created in sql which is then linked to by crystal reports.
I know it is something to do with how each system interprets the first day of the week, sql give 7 for select @@datefirst but I don't know how to check or change it in crystal.
What I don't understand is that if the function is in sql and the view in sql and gives the correct result then why does crystal not just see the results. It seems like crystal runs the view and funtions from within itself and gets a different value for the datepart(dw,@pInputDate) and causes my problem.
Main Topics
Browse All Topics





by: rrjegan17Posted on 2009-09-16 at 03:37:24ID: 25343926
>> In SQL a date of 27/07/2009 give result of 25/07/2009 (correct)
In Crystal a date of 27/07/2009 gives result of 26/07/2009 (wrong)
Are they both referring to the same database..
If not, then SET DATEFIRST differs in both databases.
Kindly check it by using
SELECT @@DATEFIRST
Default Beginning date of a week is 7 ie., Sunday..
You have to set the First date of your week to your required value to make it work
Values 1-Monday....7-Sunday