The string operator + can concatenate two or more character or binary expressions. For example:
select Name = (au_lname + ", " + au_fname) from authors
Displays author names under the column heading “Name” in last-name, first-name order, with a comma after the last name; for example, “Bennett, Abraham.”
select "abc" + "" + "def"
Returns the string “abc def”. The empty string is interpreted as a single space in all char, varchar, nchar, nvarchar, and text concatenation, and in varchar insert and assignment statements.
When concatenating non-character, non-binary expressions, use convert:
select "The date is " + convert(varchar(12), getdate())
Copyright © 2005. Sybase Inc. All rights reserved. |