Member of the LearnItFirst.com Video Training Network | LearnSqlServer.com | SQL SSIS Training | SQL Programming Tutorials |
LearnSqlServer.com Forums LearnSqlServer.com
Welcome Guest Search | New Posts | Members | Log In | Register

Date Functions Options
syed_yp@yahoo.com
Posted: Wednesday, May 14, 2008 3:02:58 PM
Rank: Newbie

Joined: 4/14/2008
Posts: 3
Points: 9
Location: Dallas, TX
Folks,

I Run this qry and get the below mentioned error!!

Qry:

select
cast(dateadd(second, Audit_Created_Date + datediff(ss,getutcdate(),getdate()),'Jan 1, 1970')as datetime) as Audit_Created_Date
From DBO.IWRPT_Sets

Error:

Msg 8116, Level 16, State 1, Line 2
Argument data type datetime is invalid for argument 2 of dateadd function.

Please respond me ASAP!!!

Thanks,
Syed
Scott Whigham
Posted: Wednesday, May 14, 2008 5:56:48 PM


Rank: Super Mod

Joined: 3/20/2006
Posts: 345
Points: 748
Location: Dallas, TX
It's just got to be *way* faster to look up the syntax in Books Online than posting in a forum. Oh well... Here you go:
Code:
DATEADD (datepart , number, date )
I'm assuming that your column "Audit_Created_Date" is a DateTime and not a number ergo the error.
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
     
Don't Forget!
LearnItFirst.com
Don't Forget!
LearnWindows2003.com
 
Home | About Us | Support | Contact Us | Privacy | Site Map | Blogs Blogs Refer a Friend and Get a Free Subscription!
© Copyright 2004-2007 LearnItFirst.com LLC. All rights reserved. All trademarks remain the property of their respective owners.
This site is not affiliated in any way with the Microsoft Corporation.