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.
| Author |
Topic |
|
tariqali
Starting Member
7 Posts |
Posted - 2005-04-11 : 11:06:22
|
| Hi,I am trying to convert datetime column to numeric or int, I tried using the cast and convert function but it is only converting and rounding down the date, and not converting the time.CONVERT(INT, PMVSTDT1) AS N_DateAny idea?thanks. |
|
|
rfrancisco
Yak Posting Veteran
95 Posts |
Posted - 2005-04-11 : 11:48:42
|
| Try this:CAST(CONVERT(VARCHAR(8), PMVSTDT1, 112) AS INT) |
 |
|
|
tariqali
Starting Member
7 Posts |
Posted - 2005-04-11 : 12:12:05
|
| That only gave me yearmonthdate format.I should have mentioned that in my previous post, but what I am looking for is to convert the datetime into Julian Datefor example:2/17/2005 4:29:00 PMshould equal to:38400.6868055556any idea?thanks. |
 |
|
|
rfrancisco
Yak Posting Veteran
95 Posts |
Posted - 2005-04-11 : 12:27:27
|
| Try this one:select convert(decimal(18, 10), PMVSTDT1, 121) |
 |
|
|
tariqali
Starting Member
7 Posts |
Posted - 2005-04-11 : 12:56:08
|
| that is it. Thanks a lot ! |
 |
|
|
|
|
|