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 2012 Forums
 Transact-SQL (2012)
 PLSQL DATE TO TSQL
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Blessed1978
Yak Posting Veteran

65 Posts

Posted - 03/04/2014 :  12:56:33  Show Profile  Reply with Quote
convert this plsl to tsql
BAL.LAST_UPDATE_DATE> sysdate-1
BAL.LAST_UPDATE_DATE<= sysdate

this should return only records based on the last update date and the day prior.

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 03/04/2014 :  13:39:36  Show Profile  Reply with Quote
This probably is not equivalent to the query you posted, but I think it meets the textual description of what you wanted:
BAL.LAST_UPDATE_DATE >= DATEADD(DAY, -1, CAST(SYSDATETIME() AS DATE))
AND BAL.LAST_UPDATE_DATE < CAST(SYSDATETIME() AS DATE)

Edited by - Lamprey on 03/04/2014 13:41:27
Go to Top of Page

MIK_2008
Flowing Fount of Yak Knowledge

Pakistan
1052 Posts

Posted - 03/04/2014 :  13:58:07  Show Profile  Reply with Quote
If SysDate in oracle/PL SQL, refers to the "date and time", then I think the equivalent would be to use Lamprey's query as


BAL.LAST_UPDATE_DATE >= DATEADD(DAY, -1, CAST(SYSDATETIME() AS DATETIME))
AND BAL.LAST_UPDATE_DATE < CAST(SYSDATETIME() AS DATETIME)

in order to account the "time" factor.

Note: you can use SysDateTime() as well as GetDate() as far as the above piece of code is concerned. The difference in both is that, in sql server, SysDateTime has more fractional seconds precision than getdate(). Check MS documentation for more details.

Cheers
MIK
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.05 seconds. Powered By: Snitz Forums 2000