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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 cdate() equavalent in SQL
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gangadhara.ms
Aged Yak Warrior

India
549 Posts

Posted - 10/05/2009 :  12:19:21  Show Profile  Reply with Quote
Dear All,
I am converting Cognos Queries into SQL Query.Can anybody tell me the equvalent SQL query for below Cognos query.

select date= (CDATE(T1."SERVICE_DATE_IH")) from T1

Thanks,
Gangadhar

gangadhara.ms
Aged Yak Warrior

India
549 Posts

Posted - 10/05/2009 :  12:29:11  Show Profile  Reply with Quote
Dear All,

Also this part of the Query

Select xyz=((YMDINT_EXTRACT(DATETIME_TO_YMDINT((CDATETIME(LASTDAY(CDATE(T1."INVOICE_CREATE_PERIOD_DT_IH"))))),4))) from T1


pls help me in this regard.

Thanks,
Gangadhar
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 10/05/2009 :  12:29:29  Show Profile  Reply with Quote
is cdate a vb function?


Like

http://msdn.microsoft.com/en-us/library/2dt118h2%28VS.85%29.aspx

???

Do you only want the Date portion of datetime data?

SELECT CONVERT(varchar(10), GetDate(), 101)



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam




Edited by - X002548 on 10/05/2009 12:33:50
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

India
549 Posts

Posted - 10/05/2009 :  12:31:08  Show Profile  Reply with Quote
Cdate() actually a Cognos Function. The query is generated by Cognos i am migrating it to SQL.

Pls help
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 10/05/2009 :  12:34:37  Show Profile  Reply with Quote
quote:
Originally posted by gangadhara.ms

Cdate() actually a Cognos Function. The query is generated by Cognos i am migrating it to SQL.

Pls help



OK, so what does cdate() do??????

I added more to my post above



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

gangadhara.ms
Aged Yak Warrior

India
549 Posts

Posted - 10/05/2009 :  12:40:37  Show Profile  Reply with Quote
I am not sure with Cdate() function in Cognos ? :(
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 10/05/2009 :  14:25:52  Show Profile  Reply with Quote
well if you don't know what it does...how can we possibly help you?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 10/05/2009 :  14:28:54  Show Profile  Reply with Quote
cdate() in vb converts the expression to date format. so i think equivalent sql statement should be convert(datetime,...) or cast(... as datetime)
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 10/05/2009 :  14:48:24  Show Profile  Reply with Quote
quote:
Originally posted by visakh16

cdate() in vb converts the expression to date format. so i think equivalent sql statement should be convert(datetime,...) or cast(... as datetime)



Kinda like post #3?




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000