BCP Error with FOR XML (500 pts)

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
makman111Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

adatheladCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
adatheladCommented:
Also, try adding SET NOCOUNT ON at the top of your procedure.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.