SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ssrs 2008 date parameter not always working


ssrs 2008 date parameter not always working

Author
Message
wendy elizabeth
wendy elizabeth
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3883 Visits: 828
In an SSRS 2008 report, I am not getting some records selected when I run the report in the ssrs 2008 report.
However when I run the sql in ssis manager, the records are selected. Thus I am trying to determine why some of the records are not selected whe running the ssrs report.

In the table called 'transactionfile', the fields that I am trying to determine where there is a problem is the following:
SchoolNumber (varchar(50),null), and
TransactionPaymentDate (varchar(50),null).

Examples of data are SchoolNumber = '121' and TransactionPaymentDate = '04162014'

In the SSRS report, the parameter value for @SchoolNumber is text and the parameter value for @EndDate and @StartDate is date/time.

The following is the query I am having a problem with:

SELECT s.SchoolNumber,
CONVERT(smalldatetime,substring(TransactionPaymentDate,5,4) + '-' + substring (TransactionPaymentDate,1,2)+ '-' +

substring(TransactionPaymentDate,3,2)) as TransactionPaymentDate

from [eF].[dbo].[transactionfile] f
INNER JOIN
[eF].[dbo].schools] s
on rtrim(ltrim(s.SchoolNumber)) =rtrim(ltrim(f.SchoolNumber))
where rtrim(ltrim(s.SchoolNumber)) = rtrim(ltrim(@SchoolNumber))
AND
Cast(Right(TransactionPaymentDate,4)+Left(TransactionPaymentDate,4) as Date)
>= @StartDate
AND
Cast(Right(TransactionPaymentDate,4)+Left(TransactionPaymentDate,4) as Date) <= @EndDate

Thus could you suggerst what could be wrong when selecting some records by date?
Jack Corbett
  Jack Corbett
SSC-Forever
SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)

Group: General Forum Members
Points: 46683 Visits: 14925
It's really hard to tell what could be the problem with all the data type manipulation being done in the query.

My first thought is that it doesn't have anything to do with the query but that there is a Filter in one of the objects in the report (dataset, tablix or data region) that is limiting the results returned. So I'd look for those first.

I'd also, in development, run Profiler to verify that what I think is being passed to the SQL Server is really what is being passed to the SQL Server.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
a4apple
a4apple
Mr or Mrs. 500
Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)

Group: General Forum Members
Points: 526 Visits: 406
Are you using this query inside a stored procedure? If so there might be an issue of Parameter Sniffing.. Check in relation with that..

Good Luck Smile .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
Jack Corbett
  Jack Corbett
SSC-Forever
SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)

Group: General Forum Members
Points: 46683 Visits: 14925
a4apple (5/2/2014)
Are you using this query inside a stored procedure? If so there might be an issue of Parameter Sniffing.. Check in relation with that..



Parameter sniffing won't cause the results returned to be incorrect it can cause a sub-optimal plan to be used skewing performance. If parameter sniffing causes incorrect results that's a bug and a very big one that I think would have been caught and fixed a long time ago.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
a4apple
a4apple
Mr or Mrs. 500
Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)Mr or Mrs. 500 (526 reputation)

Group: General Forum Members
Points: 526 Visits: 406
Jack Corbett (5/2/2014)

Parameter sniffing won't cause the results returned to be incorrect it can cause a sub-optimal plan to be used skewing performance. If parameter sniffing causes incorrect results that's a bug and a very big one that I think would have been caught and fixed a long time ago.


Jack, I only said since the data is not retrieved correctly may be check that aspect too.. I didn't mean that's the only root cause.

Good Luck Smile .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
Jack Corbett
  Jack Corbett
SSC-Forever
SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)SSC-Forever (46K reputation)

Group: General Forum Members
Points: 46683 Visits: 14925
a4apple (5/2/2014)
Jack Corbett (5/2/2014)

Parameter sniffing won't cause the results returned to be incorrect it can cause a sub-optimal plan to be used skewing performance. If parameter sniffing causes incorrect results that's a bug and a very big one that I think would have been caught and fixed a long time ago.


Jack, I only said since the data is not retrieved correctly may be check that aspect too.. I didn't mean that's the only root cause.


But parameter sniffing won't cause data to be retrieved incorrectly, just possibly not as quickly. There is no reason to consider parameter sniffing for incorrect results. For inconsistent performance yes, but not incorrect results.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search