Thanks for reaching out to Microsoft Q&A.
one way to set the MAX data length on a column of an nvarchar datatype in a hash distributed table is to use the NVARCHAR(MAX) data type. This data type can store up to 2 GB of Unicode string data..
However, if the column has any constraint key like default, check, etc., you will need to drop the key constraint from the column before altering the size of the column and then add the constraint back to the column like below
-- Drop the key constraint
ALTER TABLE table_name DROP CONSTRAINT constraint_name;
-- Alter the column size
ALTER TABLE table_name ALTER COLUMN table_column NVARCHAR(MAX);
-- Add the key constraint
ALTER TABLE table_name ADD CONSTRAINT constraint_name DEFAULT ('') FOR table_name;
Alternatively, you can also use the VARBINARY(MAX) data type but I am not sure if that is supported in hash distributed table.
Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.