SQL - Concatenation of expression error -


i working through book called 'sql queries mere mortals' , having major issue 'concatenation of expressions'.

i trying run simple command follows:

select empfirstname || ' ' || emplastname,        'phone number: ' || empphonenumber    employees  

however, sql server 2008r2 , sql server 2005 both giving me same error message:

msg 102, level 15, state 1, line 1 incorrect syntax near '|'. 

i bemused because following text of book , should work, not.

you should use + instead of ||

select empfirstname + ' ' + emplastname, 'phone number: ' + empphonenumber  employees 

correct concatenation symbol on sql server +.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -