I'm trying to create an SQL statement which merges data from date and time column to become a date + time column.
Both date and time column in my database uses nvarchar(50) as the data type and I'm using the following SQL:
select A.[Inv No], A.[Project No], [Date + Time], A.[Description], A.[Problem + Repair Details],
A.[Status], A.[Accumulative Count], A.[Preventive Count], A.[PIC]
from [SQLtest].[dbo].[Die_Entry] A
left join (select [Inv No], max(Date + Time) as [Date + Time]
group by [Inv No]) B on A.[Inv No] = B.[Inv No] where [Date + Time] = Date + Time
Order by A.[Status], A.[Date]desc
Say for example I have the date field = "3-4-2018" and a time field = "8:00:00 AM".
Ideally I want the Date + Time field to be "3-4-2018 8:00:00 AM". But in SQL's case I get "3-4-20188:00:00 AM".
The lack of space between date and time is causing my Excel program to be unable to tell its a date & time format.
How do I tell SQL to put a space in between date and time?