Concatenation

You can link columns to other columns, arithmetic expressions or constant values to create a character expression by using the concatenation operator ( || ).
A literal is a characater, number or a date inlcuded in the Select list that is not a column name or a column alias. Date and character literals must be entered within single quotation marks ('---').


All character string values pertaining to the column must be enclosed in quotes.


Processing of strings as numbers or processing numbers as strings is not a good idea an din most cases cannot be done
Access will generate an error when the wrong type of operator is used on an expression.


Merging columns (or values)is commonly known as concatenating


This can be performed by either the ampersand (&) character or the plus (+) symbol.
The main difference between them is how they handle NULL fields.



This works in both SQL Server and Access

SELECT     CompanyName + '-' + ContactName  
FROM CUSTOMERS

the only difference is when the column contains a Null value
Null + string = string
Null & string = Null



This only works in Access but not in SQL Server (as the ampersand character is not recognised)
--The string concatenation character in SQL Server is +

SELECT     CompanyName & '-' & ContactName  
FROM CUSTOMERS




© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext