Can anyone help?
The XML query gets created using XML path. I added the following for an XML output..
select top 1 LTRIM(REPLACE(SUBSTRING(mm.MATTERCODE, 1, CHARINDEX(''.'', mm.MATTERCODE)), ''0'', '''')) +
LTRIM(REPLACE(SUBSTRING(mm.MATTERCODE, CHARINDEX(''.'', mm.MATTERCODE) + 1, LEN(mm.MATTERCODE)), ''0'', ''''))
as ''MATTERCODE'', ' +
but get the following error
Msg 50000, Level 16, State 1, Procedure ls_bcp_out_from_query, Line 124
An unknown error has occurred.
The output file was not created.
at this point in the stored procedure:
-- The -a flag allows us to request a greater packet size, which will speed up processing.
set @cmd = 'bcp "' + @query + '"'
+ ' queryout ' + @temp_output_path
+ ' -t^' + @field_terminator
Line 124....+ ' -T -c -a32767'
+ ' -S ' + @@servername