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.


sqlcmd -i extract.sql -y0 -o %oudir%\extracted.dat
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.