All the searches and posts I've come across use the following to export data to a CSV file, how ever I can't get it to work.
Here's a wrinkle, the file doesn't exist, the export has to create it.
How do I get BCP export to create the file and write data ???
I've created a #temp table with the records and now I need to use a select statement to get a single record from the #temp and create and write the file. How do i do this??
This is being done from within a proc.
Create Table #Temp
Declare @CSVexport varchar(8000)
set @CSVexport = 'BCP select
From #temp where [Fld 7] = @ClientDocNo out C:\Test -c -T -S SERVER'
Exec master..xp_cmdshell @CSVexport