SQL Server 2008 Express CONCAT() doesn't exist?

I’m making switch from MySQL to SQL Server 2008 Express and can’t seem to find a CONCAT()-esque function. I have two columns I’m trying to combine into a string and find unique combinations.

id1          id2
001          abc1
002          qrs5
003          qrs5
003          abc1
...           ...

When I try the following:

  • need count of Range in sql query
  • Is there anything wrong with having a table with one column? (MSSQL Server)
  • Microsoft SQL Server Native Client Scuppered by PRINT statement
  • how to combine two results in single query in sql
  • How do I get dependent views to update automatically in SQL Server?
  • Queue up requests to a sql server stored procedure
  •   select id1, id2, concat(id1,  ", ", id2) as combo1
      FROM db1
      group by combo1

    I get the following error message:

    Msg 195, Level 15, State 10, Line 1
    ‘concat’ is not a recognized built-in function name.

    Any suggestions?

    3 Solutions collect form web for “SQL Server 2008 Express CONCAT() doesn't exist?”

    Maybe something like,

    SELECT DISTINCT id1, id2, id1 + ', ' + id2

    would that work?

    You can use CONCAT in SQL 2008 (if you REALLY want) by wrapping in brackets

    {fn CONCAT(id1,id2)} AS combo1

    NOTE: CONCAT only takes two arguments, so you must nest them if you wish to concatenate more than two strings:

    {fn CONCAT(id1,{fn CONCAT(id2,id3)})} AS combo2

    CONCATdoesn’t exist in SQL Server 2008, it is new since SQL Server 2012.

    You could use instead:

    select id1, id2, id1 +  ", " + id2 as combo1
    FROM db1
    group by combo1
    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.