So I'm trying to create a stored procedure in SQL Server that sends an email that is formatted to look a certain way. I want it to look like:
##date## ##credit##
##debit##
Where the debit and credit columns line up exactly. The problem is that everything I try results in:
##date## ##credit##
##debit##
I have tried:
declare @lineText nvarchar(max) =
CONCAT(CONCAT(right(replicate(' ',25) + '##date##',25), 'Debit: $##debit##')
, char(13)
, CONCAT(right(replicate(' ',25) + ' ',25), 'Credit: $##credit##'));
And:
declare @lineText nvarchar(max) =
CONCAT(CONCAT(LEFT('##date##' + replicate(' ', 25), 25), 'Debit: $##debit##')
, char(13)
, CONCAT(LEFT('' + replicate(' ', 25), 25), 'Credit: $##credit##'));
And:
declare @lineText nvarchar(max) =
CONCAT(CONCAT(LEFT('##date##' + space(30), 30), 'Debit: $##debit##')
, char(13)
, CONCAT(LEFT('' + space(30), 30), 'Credit: $##credit##'));
And:
declare @lineText nvarchar(max) =
CONCAT(CONCAT(CAST('##date##' as CHAR(30)), 'Debit: $##debit##')
, char(13)
, CONCAT(CAST('' as CHAR(30)), 'Credit: $##credit##'));
Nothing makes the columns line up. How do I create a string where the credit and debit columns actual align?
I want the space on the bottom line to contain the same amount of spaces as the date in the top line.
Thanks.
PRINT @lineText. Is it perhaps an issue with the font you are using (i.e. it's not fixed-width)?