Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Cognos EXTRACT function in SQL

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-09-21 : 11:53:40
Dear All,
I am using the Cognos generated query to create a View in SQL server 2005.The snapshot of the query is

((EXTRACT(DAY FROM T1."INVOICE_CREATION_DATE_IH" - T1."SERVICE_DATE_IH"))) AS 'CHARGE LAG',

Can somebody help

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-09-21 : 14:00:15
SELECT DATEDIFF(DAY, INVOICE_CREATION_DATE_IH, SERVICE_DATE_IH) AS [Charge Lag]
FROM T1



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-09-21 : 14:06:43
Thanks a lot it worked for me..
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-09-21 : 14:28:08
One more issue with Cognos Function can anybody help

CASE WHEN ((monthsbetween(cdate(T1."INVOICE_CREATION_DATE"),cdate(T1."POSTING_DATE"))) BETWEEN 0 AND 11)

what is the equvalent query in SQL
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-09-21 : 14:44:05
You are allowed to read Books Online, the SQL Server help file, you know that?

CASE WHEN DATEDIFF(MONTH, T1.[INVOICE_CREATION_DATE], T1.[POSTING_DATE]) BETWEEN 0 AND 11



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-09-22 : 04:54:44
Thanks Peso..
Go to Top of Page
   

- Advertisement -