?
Solved

BCP Error with FOR XML (500 pts)

Posted on 2003-03-11
2
Medium Priority
?
600 Views
Last Modified: 2009-12-08
I am getting the following error - any help?

C:\>bcp "EXEC dev_MSS_Portal..mytest" queryout c:\temp\bcpOut.xml -S. -Usa -P -c
 -r -t
SQLState = S1010, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Function sequence error

Stored Proc
-------------------------

CREATE PROCEDURE mytest AS

SELECT 1 AS TAG, NULL AS PARENT,
dbo.StorageCustomer.IDC            AS  [idcs!1!name],
dbo.StorageCustomer.IDCID          AS     [idcs!1!id],
NULL                                      AS [customer!2!id],
NULL                                      AS [customer!2!name],
NULL                                      AS [host!3!name],
NULL                                      AS [host!3!alias]
FROM         dbo.StorageCustomer

UNION ALL

SELECT 2 AS TAG, 1 AS PARENT,
NULL                                      AS  [idcs!1!name],
NULL                                      AS     [idcs!1!id],
dbo.StorageCustomer.CustID          AS [customer!2!id],
dbo.StorageCustomer.CustName     AS [customer!2!name],
NULL                                      AS [host!3!name],
NULL                                      AS [host!3!alias]
FROM         dbo.StorageCustomer

UNION ALL

SELECT 3 AS TAG, 2 AS PARENT,
NULL                                      AS  [idcs!1!name],
NULL                                      AS     [idcs!1!id],
NULL                                      AS [customer!2!id],
NULL                                      AS [customer!2!name],
dbo.StorageCustomer.HostName     AS [host!3!name],
dbo.StorageCustomer.HostAlias     AS [host!3!alias]
FROM         dbo.StorageCustomer

ORDER BY [idcs!1!name], [customer!2!name], [host!3!alias]
FOR XML EXPLICIT
GO
0
Comment
Question by:makman111
[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
2 Comments
 
LVL 23

Accepted Solution

by:
adathelad earned 1500 total points
ID: 8118153
Hi,

Hava a look at these links. Hope they help you out

http://dbforums.com/arch/72/2003/2/680183
http://dbforums.com/arch/72/2002/5/387992

Cheers
0
 
LVL 23

Expert Comment

by:adathelad
ID: 8118158
Also, try adding SET NOCOUNT ON at the top of your procedure.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

771 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