user5898161 February 2016

How to concat time with present date in MS SQL while converting from MySQL?

Here is Mysql code:

select concat(date_format(now(),'%Y/%m/%d'),' ','06:00:00 AM')

Trying to concat date with time, getting error like: required two parameters to concat.

MS SQL:

select concat((CONVERT(varchar,getdate(),102),' ','06:00:00 AM')); *not working while converting from mysql to sql*

Answers


Raj February 2016

concat is not recognized in SQL Server. this code should work -

select CONVERT(varchar,getdate(),102)+' '+'06:00:00 AM';


Kamil Stachowiak February 2016

There is problem with brackets. It should be:

select concat((CONVERT(varchar,getdate(),102)),' ','06:00:00 AM');


Shiju Shaji February 2016

Try This...

Select CONCAT( CONVERT(varchar,getdate(),102),' 06:00:00 AM') 

Or 
select CONVERT(varchar,getdate(),102) + ' 06:00:00 AM'

Post Status

Asked in February 2016
Viewed 2,591 times
Voted 13
Answered 3 times

Search




Leave an answer