I tried to display the output in the below format but ends up as below. Actual Output required. [ name -------------------------------------- | Harry Potter | | Ron Weasley | | Hermione Granger | | Albus Dumbledore | | Severus Snape | ] Screen capture 1 I got the output as below: 'select '|'+ right(' '+name,30)+replicate(' ',20) +'|' from [sampleDB_for excercise].dbo.plch_characters ;' [ name | Harry Potter | | Ron Weasley | | Hermione Granger | | Albus Dumbledore | | Severus Snape | ] Screen capture 2 Continue reading...