Returns a string of repeated spaces.
SPACE(integer_expression)
char
To include spaces in Unicode data, use REPLICATE instead of SPACE.
This example trims the authors’ last names and concatenates a comma, two spaces, and the authors’ first names.
USE pubs
GO
SELECT RTRIM(au_lname) + ',' + SPACE(2) + LTRIM(au_fname)
FROM authors
ORDER BY au_lname, au_fname
GO
Here is the result set:
Name
---------------------------------------------------------------
Bennet, Abraham
Blotchet-Halls, Reginald
Carson, Cheryl
DeFrance, Michel
del Castillo, Innes
Dull, Ann
Green, Marjorie
Greene, Morningstar
Gringlesby, Burt
Hunter, Sheryl
Karsen, Livia
Locksley, Charlene
MacFeather, Stearns
McBadden, Heather
O'Leary, Michael
Panteley, Sylvia
Ringer, Albert
Ringer, Anne
Smith, Meander
Straight, Dean
Stringer, Dirk
White, Olivier
Yokomoto, Akiko
(23 row(s) affected)
String Functions |