Diego Arias
Diego Arias

Reputation: 373

Scripts in SQL are compiled or executed

This is like a little existential doubt...

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

  1. I compiled the script xxxx

  2. 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.

Thank you very much.

Upvotes: 1

Views: 2405

Answers (1)

Pavel Nefyodov
Pavel Nefyodov

Reputation: 896

It depends on what you actually want to say.

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

  • Parse - Statement is broken down into individual words. Syntax errors and misspellings are detected on this step.
  • Validate (aka Resolve) – Ensures that the names of the objects are present as well as correct ownership permissions.
  • Optimise – SQL Server explores different ways to execute the query.
  • Compile – SQL Server generates execution plan (binary representation of the execution tree)

and finally

  • Execute

Upvotes: 2

Related Questions