SPACE FUNCTION IN SQL SERVER 2005
This will give space / spaces to you
SELECT ‘Pawan’ + SPACE(1) + ‘Kumar’ –This will insert one space between Pawan and Kumar.
You can replace ‘ ‘ with SPACE(1)
SELECT LEN(SPACE(2)) — This will give you 0 as len trims the spaces
SELECT DATALENGTH(SPACE(2)) — This will return 2 as datalength does not trim the spaces.
Share Knowledge.We all are here to learn.