Declaring length in sql server

I want to declare max of length in case condition i.e 7 but getting a syntax error near select in this code.

DECLARE @SQ Int(MAX) 
SELECT @SQ= MAX(LEN(FIRST_NAME))  FROM #table
SELECT @SQ 
-- 7

DROP TABLE #T
SELECT CASE WHEN LEN(SEQ_NUM) = 0 THEN NULL ELSE SEQ_NUM END AS REC_NUM,
CASE WHEN LEN(FIRST_NAME) = 0 THEN NULL ELSE CONVERT(CHAR(SELECT @SQ= MAX(LEN(FIRST_NAME)) 
 FROM #table),RTRIM(UPPER(FIRST_NAME))) END AS FIRST_NAME
 INTO #T
FROM #table

--== Need  7 Char(7) -- Max of len
DROP TABLE #T
SELECT CASE WHEN LEN(SEQ_NUM) = 0 THEN NULL ELSE SEQ_NUM END AS REC_NUM,
CASE WHEN LEN(FIRST_NAME) = 0 THEN NULL ELSE CONVERT(CHAR(7),RTRIM(UPPER(FIRST_NAME))) END AS FIRST_NAME
 INTO #T
FROM #table

I tried figuring it out and also went through this resource that has similar things but was still unable to find the solution. Can anyone help me out in finding the solution? Thank you.

Corresponding tweet for this thread:

Share link for this tweet.