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)
 date+time

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2011-07-11 : 05:02:01
i have to column
date 20110711
time 501

i want to get in this format 2011-07-11 00:05:01

how can i do it?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-07-11 : 05:17:33
that is the data type of your column ? integer ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2011-07-11 : 05:46:28
yes
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-07-11 : 06:12:38
[code]dateadd(second, [time] % 100, dateadd(minute, [time] / 100 % 100, dateadd(hour, [time] / 10000, convert(datetime, convert(varchar(10), [date]), 112))))[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -