SQL Server 2000,“用于 XML AUTO” 通过http查询,需要“Content Length = 12345” 返回 XML 标头

发布于 2024-07-09 03:40:59 字数 1309 浏览 9 评论 0原文

SQL Server 2000 Guru's,

我已经设置 SQL 2000 来接受 HTTP 查询,即 http://74.22.98.66/MYDATABASE?sql={CALL+sp_XMLDATA}+&root =root(虚构的网址) 它工作得很好,并通过 IE7 url 返回以下 XML -

<?xml version="1.0" encoding="utf-8" ?> 
 <root>
  <g c="15" /> 
  <g c="8" /> 
  <g c="19" /> 
  </root>

但是我还需要在 XML 标头“Content Length = 12345”中检索返回,即

<?xml version="1.0" encoding="utf-8" "Content Length = 12345" ?> 
 <root>
  <g c="15" /> 
  <g c="8" /> 
  <g c="19" /> 
  </root>

如何通过 SQL 2000 http 查询返回“Content Length = 12345”?

供参考 -

CREATE Procedure XML_Count

AS

DECLARE @Q_3_1_1 AS INT
DECLARE @Q_3_1_2 AS INT
DECLARE @Q_3_1_3 AS INT

CREATE TABLE #Temp1 (c INT, n INT)

INSERT INTO #Temp1 SELECT (select count(Q_3_1)   from  tblTEST  where Q_3_1 between 0 and .33) , (SELECT n = '1')
INSERT INTO #Temp1 SELECT (select count(Q_3_1)  from  tblTEST where Q_3_1 between .34 and .66) , (SELECT n = '2')
INSERT INTO #Temp1 SELECT (select count(Q_3_1)  from  tblTEST   where Q_3_1 between .64 and .99) , (SELECT n = '3')


SELECT c FROM #Temp1 AS g
ORDER BY n ASC

FOR XML AUTO

SQL Server 2000 Guru's,

I've setup SQL 2000 to accept HTTP Queries i.e.
http://74.22.98.66/MYDATABASE?sql={CALL+sp_XMLDATA}+&root=root (ficticious url)
It works great and returns the following XML via I.E.7 url -

<?xml version="1.0" encoding="utf-8" ?> 
 <root>
  <g c="15" /> 
  <g c="8" /> 
  <g c="19" /> 
  </root>

However I also need to retrieve as return in the XML header "Content Length = 12345" i.e.

<?xml version="1.0" encoding="utf-8" "Content Length = 12345" ?> 
 <root>
  <g c="15" /> 
  <g c="8" /> 
  <g c="19" /> 
  </root>

How can I return "Content Length = 12345" via SQL 2000 http query?

FYI -

CREATE Procedure XML_Count

AS

DECLARE @Q_3_1_1 AS INT
DECLARE @Q_3_1_2 AS INT
DECLARE @Q_3_1_3 AS INT

CREATE TABLE #Temp1 (c INT, n INT)

INSERT INTO #Temp1 SELECT (select count(Q_3_1)   from  tblTEST  where Q_3_1 between 0 and .33) , (SELECT n = '1')
INSERT INTO #Temp1 SELECT (select count(Q_3_1)  from  tblTEST where Q_3_1 between .34 and .66) , (SELECT n = '2')
INSERT INTO #Temp1 SELECT (select count(Q_3_1)  from  tblTEST   where Q_3_1 between .64 and .99) , (SELECT n = '3')


SELECT c FROM #Temp1 AS g
ORDER BY n ASC

FOR XML AUTO

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天煞孤星 2024-07-16 03:40:59

这可能是 XML 模板的工作。 使用模板时,您可以控制标题并使其完全按照您想要的方式显示。

This may be a job for XML Templates. When using a template you can control the header and make it exactly the way you want it.

樱花落人离去 2024-07-16 03:40:59

我发现:在常见情况下,内容长度不是 XML 标头属性, 这是一个 HTTP 字段
需要更多信息:
您使用哪种技术从 SQL Server 检索 XML 数据?
SQL DB 和您的应用程序之间的大量数据传输是否存在任何问题?
您收到任何错误消息吗?

What I have found out: in common case content-length is not a XML header attribute, it's a HTTP field.
Need more information:
Which technology are you using to retrieve XML data from SQL server?
Are there any troubles with large amounts of data transfers between SQL DB and your application?
Did you receive any error messages?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文