Joining Columns

Quite often, databases provide a table for users. Frequently, these users have their last name and first name in separate columns. Because these are typically simple strings, a feature, already discussed, allows two strings to be easily joined together.

The following code snippet shows how two columns from the AdventureWorks2008R2 database are easily joined together from within the SQL minishell:

image

Here, the first 10 records are selected, and then the LastName and FirstName values are combined together.

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.