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 |
|
fvinagre
Starting Member
29 Posts |
Posted - 2004-11-15 : 05:11:53
|
| Hi Dbas,I'm looking for a solution for the next problemI'm getting some data from the msdb system database.a) mdsb.dbo.sysjobservers.last_run_date is an int(4) with yyyymmdd date formatb)mdsb.dbo.sysjobserverslast_run_time is an int (4) with HHMM time format. I would like to convert both columms in datetime and format. But when i try to convert using "convert(datetime,dbo.sysjobservers.last_run_date)" it's returns me an overflow error . How I can convert the date int to datetime or smalldatetime?Thanks in advanceFernando |
|
|
B0g
Starting Member
19 Posts |
Posted - 2004-11-15 : 05:37:31
|
| You can try something like this:SELECT CAST(CAST(last_run_date AS CHAR(8)) AS DATETIME) FROM sysjobserversThe "last_run_time" it's a little bit dificult. You have to change like this:124001(int) -> 12:40:01 (char) ... some substring() will do thatAfter that it's simple: SELECT CAST(CAST(last_run_date AS CHAR(8) + last_run_time) AS DATETIME) FROM sysjobservers |
 |
|
|
fvinagre
Starting Member
29 Posts |
Posted - 2004-11-15 : 09:56:49
|
| Thanx a lot it was all i need Works fine!!! |
 |
|
|
|
|
|