Today is my first day playing with BCP.I'm able to spit out files for simple "SELECT * FROM Table" queries. The query below gives me the error below. I KNOW the SQL works. I can take that same query and run it in QA and get the desired results.Query:DECLARE @FileName varchar(50), @bcpCommand varchar(2000)SET @FileName = REPLACE('c:\Customer_'+CONVERT(char(8),GETDATE(),1)+'.txt','/','-')--SET @bcpCommand = 'bcp "SELECT * FROM TeleVoxASP..Account " queryout "'SET @bcpCommand = 'bcp "SELECT a.[ID], c.[ID], c.[Name] FROM TeleVoxASP..Customer c INNER JOIN Account a ON a.[ID] = c.AccountID " queryout "'SET @bcpCommand = @bcpCommand + @FileName + '" -S dev\sql2k -U myusername -P mypassword -n'SELECT @bcpCommandEXEC master..xp_cmdshell @bcpCommandOutput Error:SQLState = S0022, NativeError = 207Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'ID'.SQLState = S0022, NativeError = 207Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'ID'.SQLState = 37000, NativeError = 8180Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.NULL
Any help would be appreciated. I think I might need a format file, but the doc's don't really indicate that.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda>