I must do a report using this expression for data set:
= "SELECT * FROM Partitario WHERE DATEDIFF(d,DataScadenza, " &
Parameters!Data.Value &") > 0"
This is a part of the complete query.
I have a date as a input parameter. The field named "DataScadenza" belongs
to table "Partitario".
I have seen that this query doesn't extract anything.
The value for Datediff is always negative.
When I change the expression rendering it completely as Transact-SQL query,
I obtain the right results; but I cannot this query, it is a bit of the
complete query.
Which is the reason of this behaviour?
Many thanks for your suggestsI spend 75% of my time writing these expressions against a db2 database and
do not have the luxury of using the complete set of tsql statements. I am
bound my iseries odbc connection and what it can work with for statements.
What datasource are you working against?
Michael
"Pasquale" wrote:
> I must do a report using this expression for data set:
> = "SELECT * FROM Partitario WHERE DATEDIFF(d,DataScadenza, " &
> Parameters!Data.Value &") > 0"
> This is a part of the complete query.
> I have a date as a input parameter. The field named "DataScadenza" belongs
> to table "Partitario".
> I have seen that this query doesn't extract anything.
> The value for Datediff is always negative.
> When I change the expression rendering it completely as Transact-SQL query,
> I obtain the right results; but I cannot this query, it is a bit of the
> complete query.
> Which is the reason of this behaviour?
> Many thanks for your suggests
>|||I use a native ms sql server connection.
"MJP-tennis" wrote:
> I spend 75% of my time writing these expressions against a db2 database and
> do not have the luxury of using the complete set of tsql statements. I am
> bound my iseries odbc connection and what it can work with for statements.
> What datasource are you working against?
> Michael
> "Pasquale" wrote:
> > I must do a report using this expression for data set:
> > = "SELECT * FROM Partitario WHERE DATEDIFF(d,DataScadenza, " &
> > Parameters!Data.Value &") > 0"
> > This is a part of the complete query.
> > I have a date as a input parameter. The field named "DataScadenza" belongs
> > to table "Partitario".
> > I have seen that this query doesn't extract anything.
> > The value for Datediff is always negative.
> > When I change the expression rendering it completely as Transact-SQL query,
> > I obtain the right results; but I cannot this query, it is a bit of the
> > complete query.
> >
> > Which is the reason of this behaviour?
> >
> > Many thanks for your suggests
> >|||Are you sure that your parameter Date is in the correct date format?
Check what comes through by adding a textbox which displays the date on your
report, to see that it's not being converted in any way.
And then do a sql convert in your query, to make sure the date formats are
the same:
= "SELECT * FROM Partitario WHERE DATEDIFF(d,DataScadenza, convert(datetime,
" & Parameters!Data.Value &", 104)) > 0"
Change 104 to the ID of the date format you need to use. (Look at "Cast and
Convert" in SQL Server books online.)
Kaisa M. Lindahl Lervik
"Pasquale" <Pasquale@.discussions.microsoft.com> wrote in message
news:4EE0272F-CE1A-43AB-8F6F-E1D4F9D3B4A1@.microsoft.com...
>I must do a report using this expression for data set:
> = "SELECT * FROM Partitario WHERE DATEDIFF(d,DataScadenza, " &
> Parameters!Data.Value &") > 0"
> This is a part of the complete query.
> I have a date as a input parameter. The field named "DataScadenza" belongs
> to table "Partitario".
> I have seen that this query doesn't extract anything.
> The value for Datediff is always negative.
> When I change the expression rendering it completely as Transact-SQL
> query,
> I obtain the right results; but I cannot this query, it is a bit of the
> complete query.
> Which is the reason of this behaviour?
> Many thanks for your suggests
>
Friday, February 17, 2012
DateDiff doesn'twork
Labels:
database,
datascadenza,
datediff,
doesntwork,
expression,
microsoft,
mysql,
oracle,
parametersdata,
partitario,
report,
select,
server,
sql,
value
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment