Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Agent_datetime function from MSDB database

Jul 10 2012 12:00AM by Madhivanan   

I have posted about Creating DATETIME value from integer DATE and integer TIME where I have shown you various methods to create datetime value from integer date and time. Well. Did you know that in MSDB database there is a system function named agent_datetime that does the same thing?

select msdb.dbo.agent_datetime(20011129,211223)
The result is
-----------------------
2001-11-29 21:12:23.000
Do you want to see the script? This is what sp_helptext returns
CREATE FUNCTION agent_datetime(@date int, @time int)
RETURNS DATETIME
AS
BEGIN
 RETURN
  (
    CONVERT(DATETIME,
          CONVERT(NVARCHAR(4),@date / 10000) + N'-' + 
          CONVERT(NVARCHAR(2),(@date % 10000)/100)  + N'-' +
          CONVERT(NVARCHAR(2),@date % 100) + N' ' +        
          CONVERT(NVARCHAR(2),@time / 10000) + N':' +        
          CONVERT(NVARCHAR(2),(@time % 10000)/100) + N':' +        
          CONVERT(NVARCHAR(2),@time % 100),
    120)
  )
END

Tags: 


Madhivanan
3 · 39% · 12472
11 Readers Liked this
Madhivanan Liked this on 7/10/2012 12:28:00 AM
Profile · Blog · Facebook · Twitter
Olga Medvedeva Liked this on 7/10/2012 12:46:00 AM
Profile · Blog · Twitter
Manas Ranjan Dash Liked this on 7/10/2012 12:58:00 AM
Profile · Blog · Facebook · Twitter
Ramireddy Liked this on 7/10/2012 1:09:00 AM
Profile · Facebook · Twitter
Khyati Patel Liked this on 7/10/2012 1:46:00 AM
Profile · Facebook · Twitter
Sudeep Raj Liked this on 7/10/2012 3:29:00 AM
Profile · Blog · Facebook · Twitter
Dave Vroman Liked this on 7/10/2012 9:45:00 AM
Profile
Nakul Vachhrajani Liked this on 7/10/2012 1:09:00 PM
Profile · Blog · Facebook · Twitter
Guru Samy Liked this on 7/10/2012 11:54:00 PM
Profile · Blog
Nirav Liked this on 7/13/2012 10:19:00 AM
Profile · Blog · Facebook · Twitter
Arun Ponnurangam Liked this on 7/16/2012 1:36:00 AM
Profile
11
Liked
 
0
Lifesaver
 
0
Refreshed
 
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Agent_datetime function from MSDB database" rated 5 out of 5 by 11 readers
Agent_datetime function from MSDB database , 5.0 out of 5 based on 11 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]