SJD SJD - 3 months ago 16
SQL Question

how to remove space between two strings in sql

I have a query

CONVERT(CHAR(4), A.effort_date, 100) + CONVERT(CHAR(4), A.effort_date, 120) as Month


The result shows
Jun 2014
.

But I want to show
Jun2014
.

Have tried replace,
ltrim
,
rtrim
nothing seems to be working.

Any suggestions please?

A.effort_date
format is
2014-06-30
in sql table.

Answer

Assume you are using MSSQL, which convert format 100 is mon dd yyyy hh:miAM (or PM)

you can try

convert(char(3), A.effort_date, 100) + convert(char(4), A.effort_date, 120) as Month