SQL Report giving wrong data

%3CLINGO-SUB%20id%3D%22lingo-sub-1453696%22%20slang%3D%22en-US%22%3ESQL%20Report%20giving%20wrong%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1453696%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20use%20Crystal%20Reports%20for%20specific%20reporting%20here%20and%20SQL%20is%20run%20the%20background.%20Having%20an%20issue%20where%20the%20data%20is%20wrong.%20There%20is%20a%20start%20time%20and%20an%20end%20time%20and%20am%20looking%20for%20the%20duration%2C%20the%20weird%20part%20is%20for%20some%20of%20the%20entries%20the%20data%20is%20correct%20but%20for%20majority%20of%20the%20entries%20the%20data%20is%20wrong.%20I'm%20not%20sure%20where%20to%20look%20in%20the%20code.%20Any%20help%20would%20be%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESET%20%40START_DATE%20%3D%20CONVERT(DATETIME%2C%20CAST(%40START_DATE%20AS%20VARCHAR(11)))%3CBR%20%2F%3ESET%20%40END_DATE%20%3D%20%40END_DATE%20%2B%201%3CBR%20%2F%3ESET%20%40END_DATE%20%3D%20CONVERT(DATETIME%2C%20CAST(%40END_DATE%20AS%20VARCHAR(11)))%3C%2FP%3E%3C%2FLINGO-BODY%3E
Visitor

We use Crystal Reports for specific reporting here and SQL is run the background. Having an issue where the data is wrong. There is a start time and an end time and am looking for the duration, the weird part is for some of the entries the data is correct but for majority of the entries the data is wrong. I'm not sure where to look in the code. Any help would be appreciated.

 

SET @START_DATE = CONVERT(DATETIME, CAST(@START_DATE AS VARCHAR(11)))
SET @END_DATE = @END_DATE + 1
SET @END_DATE = CONVERT(DATETIME, CAST(@END_DATE AS VARCHAR(11)))

0 Replies