Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 603
  • Last Modified:

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
0
makman111
Asked:
makman111
  • 2
1 Solution
 
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
 
adatheladCommented:
Also, try adding SET NOCOUNT ON at the top of your procedure.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now