Returning exact field length in sql query

I am using sql to create a flat file. I have this line of sql

 case when LEFT([Last_Name_Applicant], 16) is NULL then  space(16)  else LEFT([Last_Name_Applicant], 16) end as  [NAME-L],

I want my query to return a length of 16 even if the value of the field is just 6
for example "Davies"

Query should return "Davies          "

Please assist.
SirdotsAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
lluddenConnect With a Mentor Commented:
Or SELECT LEFT([Last_Name_Applicant] + SPACE(16),16)
0
 
Chris LuttrellConnect With a Mentor Senior Database ArchitectCommented:
try :
CONVERT(CHAR(16), LEFT(Last_Name_Applicant, 16))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.