SQL 中的脚本被编译或执行

2021-09-10 00:00:00 sql tsql sql-server

这有点像存在的怀疑...

This is like a little existential doubt...

在 SQL 中运行脚本的正确说法是什么?

Which is the right way to say that you run a script in SQL?

  1. 我编译了脚本 xxxx

  1. I compiled the script xxxx

我执行了脚本 xxxx

I executed the script xxxx

我知道问这个有点奇怪和菜鸟,但我需要知道.

I know is a little weird and noob to ask this, but I need to know.

我很确定第二种方法是正确的,但我需要更多的意见.

I'm very sure the second way is the correct one, but I need more opinions.

非常感谢.

推荐答案

这取决于您实际想说的内容.

It depends on what you actually want to say.

SQL Server 中的所有查询在执行之前都遵循相同的过程.

All queries in SQL Server follow the same process before they are executed.

  • Parse - 语句被分解为单独的单词.在此步骤中检测到语法错误和拼写错误.
  • 验证(又名解析)——确保存在对象的名称以及正确的所有权权限.
  • 优化 - SQL Server 探索了执行查询的不同方式.
  • 编译 - SQL Server 生成执行计划(执行树的二进制表示)

最后

  • 执行

相关文章