Developping for the translation industry RSS 2.0

 Monday, 11 January 2010

A little quicky post on the SQL Server SPACE function. The SPACE function returns a string that consists of a specified number of spaces.

The following command will generate 10 space characters:


The use of SPACE() function is demonstrated very clearly in BOL:

USE AdventureWorks;
SELECT RTRIM(LastName) + ',' + SPACE(2) + LTRIM(FirstName)
FROM Person.Contact
ORDER BY LastName, FirstName;

A very useful little function.


Others posts:

How to generate random numbers within a T-SQL query

How to remove leading zeros within an SQL query

Some tips to enhance your SQL Server security

The T-SQL LoginProperty function in SQL Server 2005

Monday, 11 January 2010 09:42:00 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Code Snippet | SQL

About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2018
Stanislas Biron
Sign In
Total Posts: 135
This Year: 0
This Month: 0
This Week: 0
Comments: 1
All Content © 2018, Stanislas Biron