gsr
09/12/2022, 12:13 PM<cfsavecontent variable="_bcp">
-- Run this command to the database you wish to export
DECLARE @Commands TABLE(CommandText NVARCHAR(4000));
DECLARE @SQL NVARCHAR(4000);
INSERT INTO @Commands
SELECT 'bcp ' --bcp
+ QUOTENAME(DB_NAME())+ '.' --database name
+ QUOTENAME(SCHEMA_NAME(SCHEMA_ID))+ '.' -- schema
+ QUOTENAME(name) -- table
+ ' out c:\temp\csvdump\' -- output directory
+ REPLACE(SCHEMA_NAME(schema_id),' ','') + '_'
+ REPLACE(name,' ','') -- file name
+ '.xls -Usa -Pqwerty -C 65001 -t "|" -k -c -S localhost' -- extension, security
FROM sys.tables
-- Copy-paste results to DOS or Powershell prompt or create a BAT file from these.
SELECT 'mkdir #application.args.bcpbackupsFolder#\#dateFormat(now(),'MMDDYYYY')#
UNION ALL
SELECT * FROM @Commands
</cfsavecontent>
<cffile action="write" file="#application.temp#/bcp.bat" output="#_bcp#">
<cfexecute name="C:\Windows\System32\cmd.exe" arguments="#application.temp#/bcp.bat" timeout="60" outputfile="#application.logs#/log_output_bcp.txt"/>
i also tried changing the arguments value to put in name but same issueMichael Schmidt
09/12/2022, 12:59 PMgert
09/12/2022, 1:11 PM<cfexecute name="#application.temp#/bcp.bat" timeout="60" outputfile="#application.logs#/log_output_bcp.txt"/>
gsr
09/12/2022, 1:12 PMgsr
09/12/2022, 1:14 PMgsr
09/12/2022, 1:14 PMgsr
09/12/2022, 1:22 PM