cognos dates

_first_of_month(_add_months(current_date,-3)) — 1st of last 3rd month i.e. for march 10th 2018 you will get output as Dec 1st 2017

 
— end of last month
-Last day of the previous month can be determined by using the following expression:
_last_of_month(_add_months(current_date,-1))

-First day of the previous month can be determined by using the following expression:
_first_of_month(_add_months(current_date,-1))

–current date
current_date

–current date-1 or yesterday date
_add_days ( current_date, -1)

— current year last 7th day
_add_days ( current_date, -7)

–current year
extract (year, current_date)

— current year First Day of Year
_add_days(Current_date , (_day_of_year(Current_date)*-1)+1 )

–CY Total Days till today
_day_of_year (current_date)

–CY Total Days till last 7th day
_day_of_year (_add_days(current_date,-7))

— CY First Day of Current Month
_first_of_month ( current_date)

source:
https://www-01.ibm.com/support/docview.wss?uid=swg21340206

float to nvarchar in sql server

when you need to select from one column of datatype float(which has phone number) and insert it in another column as nvarchar- cast wont work

cast : cast([Column_Name] as nvarchar(50)). The result will be in format 9.07235e+009 instead of a 10 digit number (phone number).

use SELECT STR([Column_Name],10,0) ** This is SQL Server solution, for other servers check their docs