I'm not sure if this is what you are looking for, but you can work this way:
Schema
test:
CREATE TABLE teste
([HORA] VARCHAR(20))
;
INSERT INTO teste
([HORA])
VALUES
('24:00'),
('10:00'),
('5:20')
;
SELECT
CONCAT(CONVERT(CHAR(10), getdate(),126),' ',HORA,':00') AS HORA_FECHAMENTO,
CONVERT(VARCHAR(20), DATEADD(hour, +0, getdate()), 120) AS HORA_ATUAL
FROM teste
Explaining the line: CONCAT(CONVERT(CHAR(10), getdate(),126),' ',HORA,':00')
I only get the date in the format yyyy-mm-dd
and concatenate with the time it is in the bd, along with the seconds, which have not been defined either.
Note that there are logical errors in your bd, ideally you should work on the two dates in the same format, yyyy-mm-dd hh:mm:ss
, the way you are "forcing" the closing day so that it is today. / p>
See working in SQLfiddle
The concat
function is not implemented in sql-server 2008
, as output the solution can be:
SELECT
CONVERT(CHAR(10), getdate(),126)+' '+HORA+':00') AS HORA_FECHAMENTO,
CONVERT(VARCHAR(20), DATEADD(hour, +0, getdate()), 120) AS HORA_ATUAL
FROM teste