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)
 TOOADate in SQL

Author  Topic 

TMDOSS
Starting Member

33 Posts

Posted - 2010-12-12 : 21:10:31
Is there any way I can convert smalldate time to TOOAdate in SQL

Thanks

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-12-12 : 21:17:42
dateadd(dd,datediff(dd,0,mydate),0)
convert(date,mydate)


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

TMDOSS
Starting Member

33 Posts

Posted - 2010-12-13 : 11:57:28
Thanks. But it didn't convert to TOOADate(which is like deciamls
) It converted to
yyyy-mm-dd only

Thanks
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-12-13 : 13:14:12
Try
convert(float,YourDateCol)


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-12-13 : 13:54:01
I think this is what TMDOSS is after:
Declare	@dt datetime
Set @dt = 'your date here'

SELECT DateDiff(day, '18991230', @dt) +
DatePart(hour, @dt) / 24.0
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-06-29 : 08:03:53
Thanks
Go to Top of Page
   

- Advertisement -