Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to combine date and time fields in sql server 2012

$
0
0

DECLARE@TTABLE

(

[Date]VARCHAR(50),

[Time]VARCHAR(50)

);

INSERTINTO@T VALUES('2012.01.02','02:12')

INSERTINTO@T VALUES('2012.01.02','02:13')

INSERTINTO@T VALUES('2012.01.02','02:14')

INSERTINTO@T VALUES('2012.01.02','02:15')

INSERTINTO@T VALUES('2012.01.02','02:16')

INSERTINTO@T VALUES('2012.01.02','02:17')

INSERTINTO@T VALUES('2012.01.02','02:18')

INSERTINTO@T VALUES('2012.01.02','02:19')

INSERTINTO@T VALUES('2012.01.02','02:19')

INSERTINTO@T VALUES('2012.01.02','02:20')

INSERTINTO@T VALUES('2012.01.02','02:21')

INSERTINTO@T VALUES('2012.01.02','02:22')

INSERTINTO@T VALUES('2012.01.02','02:23')

INSERTINTO@T VALUES('2012.01.02','02:24')

INSERTINTO@T VALUES('2012.01.02','02:25')

INSERTINTO@T VALUES('2012.01.02','02:26')

INSERTINTO@T VALUES('2012.01.02','02:27')

INSERTINTO@T VALUES('2012.01.02','02:28')

INSERTINTO@T VALUES('2012.01.02','02:29')

INSERTINTO@T VALUES('2012.01.02','02:30')

INSERTINTO@T VALUES('2012.01.02','02:31')

INSERTINTO@T VALUES('2012.01.02','02:32')

INSERTINTO@T VALUES('2012.01.02','02:33')

INSERTINTO@T VALUES('2012.01.02','02:34')

INSERTINTO@T VALUES('2012.01.02','02:35')

INSERTINTO@T VALUES('2012.01.02','02:36')

INSERTINTO@T VALUES('2012.01.02','02:37')

INSERTINTO@T VALUES('2012.01.02','02:38')

INSERTINTO@T VALUES('2012.01.02','02:39')

INSERTINTO@T VALUES('2012.01.02','02:40')

INSERTINTO@T VALUES('2012.01.02','02:41')

INSERTINTO@T VALUES('2012.01.02','02:42')

INSERTINTO@T VALUES('2012.01.02','02:43')

INSERTINTO@T VALUES('2012.01.02','02:44')

INSERTINTO@T VALUES('2012.01.02','02:45')

INSERTINTO@T VALUES('2012.01.02','02:46')

INSERTINTO@T VALUES('2012.01.02','02:47')

INSERTINTO@T VALUES('2012.01.02','02:48')

I need to combine the date and time field into a datetime2 field.  I used combine with '+' in sql 2008, but it doesn't work in sq2l 2012.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>