sib_user
asked on
Errors exporting data from sql server.
I am attempting to export data from an sql server database to a text file using the example shown in this link: http://www.mssqltips.com/tip.asp?tip=1633.
I change the command to:
EXEC xp_cmdshell 'bcp "SELECT * FROM [CensusData].[dbo].[MainQu estionnair e$]" queryout "C:\bcptest.txt" -T -c -t,'
However I am getting the error:
Error =[Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'CensusData.dbo.MainQuesti onnaire$'. (see image)
But when I run the query by itself i.e.:
SELECT * FROM [CensusData].[dbo].[MainQu estionnair e$ all rows are returned.
What changes do I need to make to allow the EXEC xp_cmdshell command to run without errors?
I change the command to:
EXEC xp_cmdshell 'bcp "SELECT * FROM [CensusData].[dbo].[MainQu
However I am getting the error:
Error =[Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'CensusData.dbo.MainQuesti
But when I run the query by itself i.e.:
SELECT * FROM [CensusData].[dbo].[MainQu
What changes do I need to make to allow the EXEC xp_cmdshell command to run without errors?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Your answer got me past that error and I am awarding you the full points. But there is another error:
"Unable to open bcp host data file".
I shall post it in another question so that you or some other expert can have a go at it.
Thank you very much.