我试图在 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
当我离开“输出到”时,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
我愿意接受任何可能有助于我从查询中导出数据的建议。我运行了一个类似的查询,它返回一行信息,并且它确实导出而没有错误。