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 2008 Forums
 Transact-SQL (2008)
 datetime convertion

Author  Topic 

kond.mohan
Posting Yak Master

213 Posts

Posted - 2013-02-15 : 02:15:02
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

52326 Posts

Posted - 2013-02-15 : 02:27:34
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

213 Posts

Posted - 2013-02-15 : 02:32:03
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

52326 Posts

Posted - 2013-02-15 : 02:57:19
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

22864 Posts

Posted - 2013-02-15 : 07:39:44
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
   

- Advertisement -