Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I have one column date and another column with time.How can i combine both into single column with date and time?FDATE FTIME20060101 06361620060101 070743CREATE TABLE payment2 ( FDATETIME Datetime FTIME Character(12));INSERT INTO payment2 values ('20060201', '164044');INSERT INTO payment2 values ('20060201', '175914');
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2007-08-20 : 01:45:16
Why dont you use just DATETIME datatype and then seperate time from date when needed?Here is one of the methods
select FDATETIME, FTIME, dateadd(second,cast(ftime as int)/10000*3600+ cast(ftime as int)/100%100*60+ cast(ftime as int)%100,fdatetime) as date_timefrom payment2
MadhivananFailing to plan is Planning to fail
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2007-08-20 : 01:46:24
and this forum is to post workable scripts and not to ask a question MadhivananFailing to plan is Planning to fail
hkben
Starting Member
4 Posts
Posted - 2007-08-20 : 02:05:40
Thanks, I will move the question to other place.The data i extract from the Point of Sales has two columns.But I need a single column with format "mm/dd/yyy HH:MM:SS" when i import into SQL for my BI project.