SPACE FUNCTION IN SQL SERVER 2005

This will give space / spaces to you

Eg.
SELECT ‘Pawan’ + SPACE(1) + ‘Kumar’ –This will insert one space between Pawan and Kumar.
You can replace ‘ ‘ with SPACE(1)

Eg.
SELECT LEN(SPACE(2)) — This will give you 0 as len trims the spaces

Eg.
SELECT DATALENGTH(SPACE(2)) — This will return 2 as datalength does not trim the spaces.

Share Knowledge.We all are here to learn.

Pawan Kumar

Pawankkmr@hotmail.com