How can I increase the length of the string returned by object_definition in sqlcmd? I have an sql script that uses select object_defintion(object_id(...)) to extract the definition from a view.

This script is run with sqlcmd: sqlcmd -i extract.sql -o %oudir%\extracted.dat.

Unfortunately, the length of the returned string seems to be truncated so that not the entire view definition is extracted.

Is there a possibility to extend the length of the returned string?
Specify the -y SQLCMD option to avoid truncating the value to the 256 character default. -y0 will not truncate the value but should be used with caution as mentioned in the doc.

Example:

sqlcmd -i extract.sql -y0 -o %oudir%\extracted.dat