Export CLOB / TEXT data

mssql-cmd - SQL Server interactive and batch query command-line tool »

Download mssql-cmd Free Trial »

Long text columns are omitted by default. Set exportclob=y to include CLOB, TEXT or NVARCHAR(MAX) values in the output file.

mssql-cmd> unload header=y exportclob=y table=documents datafile=e:\temp\documents.txt delimiter="|" quote="chr(34)";

Batch:

mssql-cmd dsn="user:password@host:1433/dbname" task=unload header=y exportclob=y table=documents datafile=e:\temp\documents.txt delimiter="|" quit=y

For binary data (BLOB, BYTEA, VARBINARY), use exportlob instead.