Hello, I have a bcp script that generates stored procedure code output as shown below.
bcp "select RTRIM(LTRIM(c.text)) FROM sys.objects AS o INNER JOIN sys.syscomments AS c ON o.object_id = c.id WHERE o.type = 'P' AND o.name = 'sp_ic9av0_dx_length'" queryout "\\dbserver1\j$\Backup\NG Sps\sp_ic9av0_dx_length.sql" -t -c -r "\t" -SServer1 -T -dMyDb
There is a formatting issue in the output script that prevents it from compiling without modifying it first. I believe it has something to do with a space after the line terminator. Notice there is a space in the highlighted column name below. If I simply remove the space, the stored procedure will compile. Is there a wat to instruct bcp to handle this scenario correctly?
AND patient_provider_role_.txt_prov ider_role = @provider_role