I am using the following statement:
EXEC master..xp_cmdshell 'BCP "Select * from #tempTable" QUERYOUT E:\Temp\Sal1.csv -c -t "|" -T -S myserver'
Here is the errors I received:
SQLState = S0002, NativeError = 208
Error = [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid object name '#tempTable'.
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC Driver 11 for SQL Server]Unable to resolve column level collations
BCP copy out failed
If the Table is permanent I have no problem. But I do not want to create permanent table for every data output result. Can this situation be resolved without using permanent table.