【问题标题】:Does the less than symbol in SQL serve another purpose other than being a operator?SQL 中的小于号除了作为运算符之外还有其他用途吗?
【发布时间】:2020-03-02 13:33:50
【问题描述】:

我让供应商为我们编写了一个脚本,我们收到与该行有关的错误

WHERE 1=1 AND student.calendarID = <selected Calendar>.

我从未见过"<selected abc>" 的语法。有人可以向我解释一下吗?它也为该行返回错误。我正在使用 MS SQL Server。

SELECT DISTINCT student.personID
FROM student
join TranscriptCourse tc on tc.personID = student.personID
join TranscriptCourse tc2 on tc2.personID = tc.personID and tc.coursenumber = tc2.coursenumber
WHERE 1=1 AND student.calendarID = <selected Calendar>
AND student.endYear = <selected Year>
AND student.structureID = <selected Schedule>
and tc.gpavalue > 69 and tc2.gpavalue > 69
and tc.transcriptID > tc2.transcriptID
and tc.grade in ('09','10','11','12')
and tc2.grade in ('09','10','11','12')

【问题讨论】:

  • 它旨在作为一个占位符,让您将自己的值放入...换句话说...删除 并放入您自己的值,例如 2020

标签: sql sql-server join select


【解决方案1】:

在我看来,Template Parameters 使用不当

如果以&lt;parametername, parametertype, defaulvalue&gt; 格式正确使用,例如&lt;SelectedCalendar, int , 0&gt;,您可以使用查询> 为模板参数指定值或Ctrl+Shift+M 快捷方式,您将获得一个窗口,您可以在其中为每个模板填充值:

【讨论】:

    【解决方案2】:

    尖括号是常见的计算机科学和软件工程编程语言定义元字符,又名notation used to talk about programs 的字符,又名元语言的字符,又名元表示法。 (不要与 characters treated specially compared to other characters by a system 的不同含义混淆。)在关于程序的非正式交流中,我们的元语言往往是自然语言加上从更正式的符号中窃取的位。

    通常&lt;x&gt; 表示您可以用程序文本替换的类型 x 的泛型表达式。

    所以&lt;selected Schedule&gt; 仅表示用于标识时间表的值的一些语言文本。这是一个参数的伪代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-14
      • 2010-10-25
      • 2014-04-25
      • 1970-01-01
      • 2018-05-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多