sql server - T-SQL concatenate & convert string to date time -


i have table (once again implemented bio-metric software) stores date , time strings in different columns.

date column stores date 20160128 january 18 2016 , time column stores time 220747 (10:07:47 pm).

how can concatenate both strings , convert valid datetime value?

i have referred few of other questions asked here , found many of them refers date part, missing time factor

table structure

if can manipulate strings format sql server can natively parse, can cast - e.g. yyyymmdd hh:mm:ss format:

declare @date char(8) set @date = '20160128'  declare @time char(6) set @time = '220747'   select cast(@date + ' ' + substring(@time, 1, 2) + ':' + substring(@time, 3, 2) + ':' + substring(@time, 5, 2) datetime) 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -