I would actually change the variable definition.
@max-2 AS NVARCHAR(MAX) = ''
, @Var AS NVARCHAR(MAX) = 'ABCabc123';
@max-2 = REPLICATE(@Var, 445);
CASE WHEN LEN(@Max) = LEN(@Var) * 445 THEN 'Simple math'
ELSE 'It''s complicated'
This is a common problem when creating long dynamic sql strings. I hope that people learn from this question.
How to post data/code on a forum to get the best help: Option 1 / Option 2
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?