I have created a temp table, now I want to dump the contents into a text file.The table is created properly, but when it comes to writing the text file, I get a couple of warnings and erros.Here is the code from the s-proc to write the contents out to file:SELECT * FROM #Accounts declare @sql varchar(8000) SELECT @sql = 'bcp tempdb..#accounts out i:\ExportFiles\Test.txt -c -t, -T -S ' + @@servername exec master..xp_cmdshell @sql
Here are the errors and warnings:SQLState = 01000, NativeError = 2701Warning = [Microsoft][ODBC SQL Server Driver][SQL Server]Database name 'tempdb' ignored, referencing object in tempdb.SQLState = 01000, NativeError = 2701Warning = [Microsoft][ODBC SQL Server Driver][SQL Server]Database name 'tempdb' ignored, referencing object in tempdb.SQLState = S0002, NativeError = 208Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name '#accounts'.
Any suggestions?Mike B