• print like this. it will work

    print substring(@sql,1,3999)

    print substring(@sql,4000,8000)

    ........