Monday 12 December 2011

SPACE() Function in SQL

Some of my friends has a lot of confusions about the functions SPACE() and it's implementations.

The SPACE function takes Integer as parameters and Returns a specified number of spaces as string.

The number of space it returns is what number you provide in the parameters.

The syntax is

 SPACE(expression int)RETURN varchar

 

EXAMPLE

SELECT fname +','+SPACE(2)+lname 'Student Name'

FROM   tbl_student

RETURN VALUE

Student Name

RAJA, KUMAR

DIA, MIRZA

 

The Spce came in between , and Last name.

Posted By: MR. JOYDEEP DAS

 

1 comment: