[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Errors exporting data from sql server.

Posted on 2010-09-14
2
Medium Priority
?
229 Views
Last Modified: 2012-05-10
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].[MainQuestionnaire$]" 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.MainQuestionnaire$'.  (see image)  

But when I run the query by itself i.e.:
SELECT * FROM [CensusData].[dbo].[MainQuestionnaire$ all rows are returned.

What changes do I need to make to allow the EXEC xp_cmdshell command to run without errors?
0
Comment
Question by:sib_user
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
Chris Mangus earned 2000 total points
ID: 33677979
Add -S parameter and specify your server name.
0
 

Author Comment

by:sib_user
ID: 33678006
cmangus,

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.

0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question