如何强制MS Access保留其SQL格式? [英] How do I force MS Access to retain its SQL formatting?

查看:74
本文介绍了如何强制MS Access保留其SQL格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MS-Access中使用了大量SQL,因此我需要对其进行格式化,以使其易于阅读.问题是,当我在视图之间切换时,我最终将SQL压缩为无法读取的内容.

I have a lot of SQL at work in MS-Access, and I need to formatted so that it's human readable. The issue is when I change between views I end up with the SQL being condensed down into something that I can't read.

转到其他视图时,如何强制SQL保留其形状"?

How do I force SQL to retain its 'shape' when I go to other views?

推荐答案

我发现了一个黑客,

I found a hack, here. The secret lies in enclosing your query inside a dummy query. Like so:

SELECT * FROM (SELECT   <-----here
Table1.Field1,
Table1.Field2
FROM
Table1

WHERE
Table1.Field2 = "Yes") AS query1 <-----here

我已经指出了包装代码的位置和方式.我能看到的唯一问题是,如果您想在设计视图中编辑代码,那么似乎根本没有选择随附的代码.

I've indicated where and how you wrap the code. The only issue I can see is if you wanted to edit the code in design view, then it doesn't seem to pick the enclosed code up at all.

这篇关于如何强制MS Access保留其SQL格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆