I have three fields that I concatenated into one field, but when I run the query the result-set is correct, but they are not evenly spaced within the one field. How would I space them neatly and correctly. Thank-you for the help.
Here is the query:
SELECT CONVERT(varchar(20),Book)+ Space(2) + '(' + CONVERT(varchar(30),Year)
+ ')' + Space(2) + '(' + CONVERT(varchar(30),Print) + ')' As 'Film Description', Genre,
Cost
FROM Film
Order By Year DESC, Book ASC
Since
VARCHARignores trailing spaces, you need to use a different data type that doesn’t (e.g.CHAR). A few other comments:yearandprintas column names'single quotes'as alias delimiters ([square brackets]are more future-proof and harder to muddle with string literals)dbo.Film)