我试图将我的sql Server查询结果导出为.txt格式的文件夹(这是一个自动化的工作)
我知道在MySQL中使用与INTO OUTFILE相同的功能.有没有人知道在sql Server 2008 Management Studio中执行此操作的最佳方法?
SELECT DISTINCT RTRIM (s1.SGMNTID) AS 'AccCode',RTRIM (s1.DSCRIPTN) AS 'CodeDesc',CASE WHEN s1.SGMTNUMB = '1' THEN '1' WHEN s1.SGMTNUMB = '2' THEN '2' WHEN s1.SGMTNUMB = '3' THEN '110' WHEN s1.SGMTNUMB = '4' THEN '4' WHEN s1.SGMTNUMB = '5' THEN '120' END AS 'AccountType_id',CASE WHEN s1.SGMTNUMB = '2' THEN LEFT(s1.SGMNTID,2) ELSE 'DEFAULT' END AS 'AccGroupName' FROM GL40200 s1 UNION SELECT REPLACE ([ACTNUMBR_1]+'-'+ [ACTNUMBR_2]+'-'+ [ACTNUMBR_3]+'-'+[ACTNUMBR_4]+'-'+ [ACTNUMBR_5],' ','') AS 'AccCode','' AS 'CodeDesc','0' AS 'AccountType_id','Default' AS 'AccGroupName' FROM GL00100 a INTO OUTFILE 'C:\Users\srahmani\verian/myfilename.txt'