Tuesday, 8 August 2017

SPACE() Function in SQL

SPACE function is used to add spaces to a string. The SPACE function takes Integer as parameters and Returns a specified number of spaces as string.
Syntax
SPACE(integer_expression)

integer_expression can be any positive number to indicate number of spaces to add . If you specify negative number then it returns NULL.  
Return type of SPACE function is char.
See the example

No space
Now I am added space function

Returning 8 char space.
If we give negative value in space function it will return null value.
  

 SPACE function will return a maximum of 8000 spaces only. 

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts