Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using dateadd(year, -1, @MyDate) in sp does not bring any data with Crystal but does with SQL

Status
Not open for further replies.

Luvsql

Technical User
Apr 3, 2003
1,179
CA
I'm using this syntax in a Where statement in my sp in SQL 2008. I run my sp in SQL and there is data for this particular field. However, when I access this sp this one field is BLANK in Crystal Report. I doesn't even acknowledge the datatype. I know in CR it uses dateadd('yyyy',-1,@MyDate) as its syntax, but I have to run it in SQL.

Why does CR not acknowledge this? All CR should do is pass the sp parameter values and bring back the data. Why is it NOT bringing back this particular field that uses the Dateadd? I have other fields using DatePart and it works, but not this. If I edit the syntax and use something else just to see if it then brings data in, it does. It does not like DateAdd(year..) WHY?

There is no other way to get one full year back with my parameter.
 
Is the datatype in SQL Server date? Crystal has a hard time with that, if so you may want to try it as a datetime instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top