0

Hello People more knowledgeable than me,

I'm taking some online courses for SQL and I am curious about something. With some instructors they draft script and don't seem to be concerned about ending simple commands with a ; however, other instructors seem to religiously add the semicolon at all times.

I'm just wondering, how important is the semicolon, should it be something that is always part of your script or does it not matter?

I know it's a pretty simple question, but the intro classes don't really define exactly why it's needed and since I'm seeing it used differently... I just want to make sure I understand.

Thank you!

SQL_Noob
  • 1,161
  • 1
  • 9
  • 18
  • Hi Kaf, I looked through some of the semicolon questions but I must have missed that one. I do apologize if it's a duplicate. – SQL_Noob Oct 22 '13 at 14:23
  • Hay, Honestly nothing to apologise, it can happen to anyone. I just pointed possibly a similar question answered before. – Kaf Oct 22 '13 at 14:27

2 Answers2

3

Terminating semi-colons will be required in some future version of SQL Server.

Although it's not currently required, it's not a bad habit to get into.

alroc
  • 27,574
  • 6
  • 51
  • 97
1

As far as I know, I neglect semi-colons all too much, and my scripts nearly never break. So my best guess is no.

Still makes the code more readable since you do add a layer of seperation in your code.

Oh, you must use them at CTEs though which aren't first in batch

Eon
  • 3,833
  • 10
  • 46
  • 75