Sybase SQL Anywhere - 无法将数据导出到文件

发布于 2024-10-24 08:45:05 字数 928 浏览 4 评论 0原文

我尝试在 Sybase SQl Anywhere 中导出查询,但在执行 OUTPUT TO 命令时收到错误。我的查询如下所示:

SELECT User_Name as 'Remote Database', nDaysBehind as 'Days Behind', Time_Received as 'Last Message Received'
FROM DailySynchRptView
WHERE Time_Received < today() -1 AND nDaysBehind > 0
ORDER BY Time_Received ASC 
OUTPUT TO c:\daysbehind.txt format ascii

当我省略“OUTPUT TO”时,ISQL 中显示的信息如下:

Remote Database,Days Behind,Last Message Received
'Rem00027',23,'2011-02-23 16:10:14.000'
'Rem00085',7,'2011-03-11 04:47:02.000'
'Rem00040',5,'2011-03-13 15:22:15.000'
'Rem00074',4,'2011-03-14 16:01:25.000'
'Rem00087',3,'2011-03-15 06:04:16.000'

但是,当将 OUTPUT TO 命令放入查询中时,我收到以下错误:

Could not execute statement.
Syntax error near 'OUTPUT' on line 5
SQLCODE=-131, ODBC 3 State="42000"
Line 1, column 1

I am open to any可能帮助我从查询中导出数据的建议。我运行了一个类似的查询,它返回一行信息,并且导出时没有错误。

I am attempting to export a query in Sybase SQl Anywhere but am receiving an error when getting to the OUTPUT TO command. My query looks like this:

SELECT User_Name as 'Remote Database', nDaysBehind as 'Days Behind', Time_Received as 'Last Message Received'
FROM DailySynchRptView
WHERE Time_Received < today() -1 AND nDaysBehind > 0
ORDER BY Time_Received ASC 
OUTPUT TO c:\daysbehind.txt format ascii

The information that shows up in ISQL when I leave off the "OUTPUT TO" is the following:

Remote Database,Days Behind,Last Message Received
'Rem00027',23,'2011-02-23 16:10:14.000'
'Rem00085',7,'2011-03-11 04:47:02.000'
'Rem00040',5,'2011-03-13 15:22:15.000'
'Rem00074',4,'2011-03-14 16:01:25.000'
'Rem00087',3,'2011-03-15 06:04:16.000'

However, when the OUTPUT TO command is placed in the query, I receive the following error:

Could not execute statement.
Syntax error near 'OUTPUT' on line 5
SQLCODE=-131, ODBC 3 State="42000"
Line 1, column 1

I am open to any suggestions that might help me be able to export the data from the query. I have ran a similar query that returns a single line of information and it does export without errors.

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

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

发布评论

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

评论(1

筑梦 2024-10-31 08:45:05

查看代码一段时间后,我发现我缺少一个分号 ; 来分隔两组命令。在 OUTPUT 行之前添加分号后,我就可以导出信息。

After a while looking at the code, I found that I was missing a semi-colon ; to separate the two sets of commands. Once I added the semi-colon before the OUTPUT line, I was able to export the information.

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