In SQL Server, VARCHAR(n) data type stores variable-length character strings up to n bytes with the maximum of 8,000 bytes or 2 GB if VARCHAR(max) is specified.
In PostgreSQL, you can use VARCHAR(n) that can store up to 1 GB (bytes).
SQL Server:
CREATE TABLE specs ( item VARCHAR(30), name VARCHAR(100), notes VARCHAR(MAX) );
PostgreSQL:
CREATE TABLE specs ( item VARCHAR(30), name VARCHAR(100), notes TEXT );
Conversion summary:
| SQL Server | PostgreSQL | |
| Syntax | VARCHAR[(n)] | VARCHAR[(n)] | 
| Parameter | n is the number of bytes | n is the number of characters | 
| Range | 1 ⇐ n ⇐ 8,000 or 2 GB if MAX is specified | 1 ⇐ n ⇐ 10,485,760 | 
| Default | n is 1 | 1 GB | 
For more information, see SQL Server to PostgreSQL Migration.