SQL Query,是否可以动态导出结果?

时间:2015-07-01 13:56:41

标签: sql sql-server

我正在使用下面的查询来获得一些结果,但我希望将其导出到csv。这也可以用标题吗?

Select 
 sys.Netbios_Name0, 
 sys.User_Domain0, 
 sys.User_Name0, 
 sys.Operating_System_Name_and0, 
 arp.DisplayName0,
 ARP.Version0
FROM 
 v_R_System sys
 JOIN v_Add_Remove_Programs arp ON sys.ResourceID = arp.ResourceID 
WHERE 
 Displayname0 like '%Adobe Reader%'

1 个答案:

答案 0 :(得分:1)

嘿,您可以在SQL

中尝试Openrowset
INSERT INTO OPENROWSET 
('Microsoft.Jet.OLEDB.4.0', 
'Excel 8.0;Database=c:\Test.xls;HDR=YES','Select 
 sys.Netbios_Name0, 
 sys.User_Domain0, 
 sys.User_Name0, 
 sys.Operating_System_Name_and0, 
 arp.DisplayName0,
 ARP.Version0
FROM 
v_R_System sys
JOIN v_Add_Remove_Programs arp ON sys.ResourceID = arp.ResourceID WHERE 
Displayname0 like ''%Adobe Reader%''')

希望它可以帮到你