1. The first SET @bcpCommand is malformed, it needs to be
SET @bcpCommand = 'bcp "select ''' + @CTX_TRAILER +'''" queryout "'
2. @CTX_TRAILER is char(2000) and @bcpCommand varchar(2000) therefore it is too small to contain the command and the command will be truncated thus causing an error
based on the definition you posted @bcpCommand needs to be at least varchar(2083)
Far away is close at hand in the images of elsewhere.
Anon.