我正在寻找有关lua脚本的帮助,该脚本应该以可读的格式输出表的结果。
此脚本仅将结果打印为表引用:
database.open("provider=nis;database=nis;driver=none")
query = database.query("SELECT distinct cmcs.name, ms.schedule_name, mw.start_time, mw.end_time from MAINTENANCE_WINDOW mw INNER JOIN CM_DEVICE cmd on mw.dev_id = cmd.dev_id INNER JOIN CM_COMPUTER_SYSTEM cmcs on cmcs.cs_id = cmd.cs_id INNER JOIN MAINTENANCE_SCHEDULE ms on mw.schedule_id = ms.schedule_id where mw.end_time > GETDATE();")
print (query)
以上输出:
table:0x7fe8f40e6f00
我有以下脚本,但它没有输出我期望看到的内容:
database.open("provider=nis;database=nis;driver=none")
query = database.query("SELECT distinct cmcs.name, ms.schedule_name, mw.start_time, mw.end_time from MAINTENANCE_WINDOW mw INNER JOIN CM_DEVICE cmd on mw.dev_id = cmd.dev_id INNER JOIN CM_COMPUTER_SYSTEM cmcs on cmcs.cs_id = cmd.cs_id INNER JOIN MAINTENANCE_SCHEDULE ms on mw.schedule_id = ms.schedule_id where mw.end_time > GETDATE();")
if query == nil then
print ("Query did not complete, or had no results")
else
for idx,row in pairs (query) do
printf("Hostname: %s \t IP: %s",row['name'],row['schedule_name'])
end
end
下面是在sql server本身上运行时sql输出的屏幕截图(如果有任何输出是这样的话):
1条答案
按热度按时间6vl6ewon1#
知道了:
希望它能帮助别人!