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

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 datetime convertion
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kond.mohan
Posting Yak Master

India
185 Posts

Posted - 02/15/2013 :  02:15:02  Show Profile  Reply with Quote
Hi all,
i have executed one query on ORACLE Server i got below output.
select * from openquery(finuat,'select (trunc(sysdate, ''MONTH'') - 1) from dual ')
output is: 2013-01-31 00:00:00.0000000.
we are trying but getting wrong data
pls provide the Convertion function in sql server



visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 02/15/2013 :  02:27:34  Show Profile  Reply with Quote
what should be your required output? i think it returns correct result as per expression used

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kond.mohan
Posting Yak Master

India
185 Posts

Posted - 02/15/2013 :  02:32:03  Show Profile  Reply with Quote
we fetchig in oracle query 2013-01-31
my MSSql query need to fetch the same figure.

mohan
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 02/15/2013 :  02:57:19  Show Profile  Reply with Quote
in sqlserver you need

DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)-1

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22713 Posts

Posted - 02/15/2013 :  07:39:44  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
quote:
Originally posted by kond.mohan

we fetchig in oracle query 2013-01-31
my MSSql query need to fetch the same figure.

mohan


If you need only DATE part, use convert function or do it in a front end application

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.08 seconds. Powered By: Snitz Forums 2000