How to concatenate two strings in SQL Server 2005

后端 未结 6 1314
夕颜
夕颜 2020-12-06 09:16

I want to concatenate the words \"dummy\'s\" and \"dock\".

How can I concatenate them in SQL Server 2005? Does it support double quotes?

6条回答
  •  执念已碎
    2020-12-06 09:36

    To concatenate two strings in 2008 or prior:

    SELECT ISNULL(FirstName, '') + ' ' + ISNULL(SurName, '')
    

    good to use ISNULL because "String + NULL" will give you a NULL only

    One more thing: Make sure you are concatenating strings otherwise use a CAST operator:

    SELECT 2 + 3 
    

    Will give 5

    SELECT '2' + '3'
    

    Will give 23

提交回复
热议问题