SELECT [NAME Code] + CONVERT( char(30), ISNULL(CONVERT(VARCHAR(30), [Scrap Reference Number]), ' '))A couple of comments:
CAST ( ISNULL( CAST([Scrap Reference Number] AS VARCHAR(30)), ' ') AS char(30))>I have to create several files to FTP to a UNIX machine. The layout of the data is column specific that is each column has a maximum length and position.
>SELECT [NAME Code] > +SUBSTRING(REPLICATE(' ', 30-LEN(CONVERT(VARCHAR, [Scrap Reference Number]))) ISNULL(CONVERT(VARCHAR, [Scrap Reference Number]), ' '),1,30) >