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
 General SQL Server Forums
 New to SQL Server Programming
 Converting SMALLINT to DATETIME

Author  Topic 

groberts1980
Starting Member

1 Post

Posted - 2008-11-19 : 13:34:51
I have a time field in a database that is set up as SMALLINT. How can I convert that into DATETIME with a query? So basically when I am pulling it out of the query, I would like to do the conversion then.

Any help is greatly appreciated.

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2008-11-19 : 13:51:26
DECLARE @Foo SMALLINT
SET @Foo = 1
SELECT CAST(@Foo AS DATETIME)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-20 : 01:54:09
quote:
Originally posted by groberts1980

I have a time field in a database that is set up as SMALLINT. How can I convert that into DATETIME with a query? So basically when I am pulling it out of the query, I would like to do the conversion then.

Any help is greatly appreciated.


What does the value refer to? days, minutes, seconds,etc?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -