Cognos Tech Tip: SQL Functions in Cognos

Learn how to use SQL functions in Cognos to enhance report logic and unlock more powerful data queries and calculations.

SQL Functions in Cognos

If you have tried using certain SQL functions that you know should work but you get errors…you may have to modify your syntax slightly for Cognos.

Example: dateadd(mm, 1, getdate())
Result in SQL Server Management Studio: Mar 16, 2015 12:19:27 PM
Result in Cognos: Parsing error before or near position: 12 of: “dateadd(mm,”

Solution: You must wrap the “mm” in curly brackets “{}”
Working Query Calculation: dateadd({mm}, 1, getdate())

Result:

Of course you can cast it if you want just the date. Cast(dateadd({mm}, 1, getdate()), date)

 

This works with MANY SQL functions that you may struggle with.  Hope that helps!

Cheers!

All Posts

Alteryx
Subscribe to our newsletter

Sign up for the very best tutorials and the latest news.

* indicates required

We care about your data in our privacy policy.

Related blog posts

Business Intelligence & Analytics, Cognos BI & Analytics, Cognos Tips & Tricks
The Differences between a Cognos Dashboard and an Active Report
Compare Cognos Dashboards vs Active Reports to understand key differences in capabilities, use cases, and best scenarios for each reporting style.
Business Intelligence & Analytics, Cognos BI & Analytics, Cognos Tips & Tricks, Cognos Training
Auditing for Accurate Cognos Reports
All Cognos reports need to be checked to ensure the report produces accurate data. Follow these tips to eliminate any potential errors in your report.
Cognos BI & Analytics, Cognos Tips & Tricks, Cognos Training
Using IBM Cognos for Microsoft Office
Learn how IBM Cognos for Microsoft Office connects Cognos Analytics data to Excel, Word, and PowerPoint for dynamic, accurate reporting.

Contact Us

Interested in learning more? Contact info@capitalizeconsulting.com.