将访问查询转换为SQL [英] Converting an access query to SQL

查看:53
本文介绍了将访问查询转换为SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下查询是由其他人编写的,我需要帮助转换为SQL查询,有人可以帮我这个吗?


谢谢

I have the following query that was written by someone else that I need help converting to a SQL query, can anyone assist me with this?

Thank you

展开 | 选择 | Wrap | 行号

推荐答案

当然。


具体在哪里需要帮助吗?


您已经尝试了什么以及您有什么结果(或错误)?
Sure.

Where specifically do you need help?

What have you tried already and what results (or errors) have you had?


我不太确定关于这里的语法差异。 格式命令是我偶然发现的第一件事。


所以这里是我开始的地方
Well I''m not really sure on the syntax differences here. The "format" command is the first thing that I''ve stumbled into.

So here is where I''m starting from
展开 | 选择 | Wrap | 行号


Doug ,我会处理格式问题,但这不是我要求的。如果你的格式命令有问题,我不想游遍15行可疑的SQL来找到它。这可能是你最终的目标,但我故意要求提出具体问题。如果你可以和我一起工作那么我可以和你一起工作。


无论如何,SQL Server中使用的语言T-SQL有几个功能来完成格式化数据的工作从一种类型到另一种类型。这些是 CAST() CONVERT()。被警告。它们与Jet SQL(Access中使用的SQL)明显不同。 CONVERT()中有各种选项(我希望这对你来说更合适),这里列出的内容太多了。其中一个问题是它们是有限的列表。他们没有你习惯的灵活性格式化()我很害怕。


上下文相关帮助很有效来自Management Studio。键入CONVERT并按F1查看相关页面,其中包含完整详细信息。 101为mm / dd / yyyy,103为dd / mm / yyyy,111为yyyy / mm / dd等
Doug, I''ll deal with the format issue, but this is not what I was asking for. If you have a problem with your format command I don''t want to have to swim through 15 odd lines of questionable SQL to find it. That may be your eventual aim, but I asked for specific questions deliberately. If you can work with me then I can work with you.

Anyway, T-SQL, the language used in SQL Server, has a couple of functions that do the job of formatting data from one type to another. These are CAST() and CONVERT(). Be warned. They are markedly different from Jet SQL (The SQL used in Access). There are various options available in CONVERT() (I would expect this to be the more appropriate for you on this one), too many to list here. One of the problems is that they are a finite list. They don''t have the flexibility you''d be used to with Format() I''m afraid.

Context-sensitive Help works well from Management Studio. Type CONVERT and press F1 to see the relevant page with full details appear before you. 101 for mm/dd/yyyy, 103 for dd/mm/yyyy, 111 for yyyy/mm/dd, etc.


这篇关于将访问查询转换为SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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