2.9. A Few Notes About SQL Server Syntax
A few things that you need to know about syntax
in SQL Server :
-
SQL Server allows blank lines in the SQL window.
-
Queries in SQL Server do not have to end in a semicolon.
-
SQL Server allows you to include comments anywhere in a SQL script or query.
Many other SQL languages will not let you include a comment as the first line of a script or
query (other SQL languages will look for a SQL statement beginning with a command like
SELECT on the first line of a script or query), but SQL Server will allow you to include a
comment on the first line of a script or query. SQL Server also allows comments after the
semi-colon (which may have been used to end a query). Many SQL languages will not accept
anything typed after the semi-colon.
-
SQL Server will allow you to type in multiple queries on the query editor
screen at one time, and you may only execute the ones that you wish to execute. For example,
if you type in the following three queries on the query editor screen:
SELECT *
FROM Dependent
SELECT *
FROM Student
SELECT *
FROM Course
To first execute the middle query, SELECT * FROM Student, you may highlight
this query and clickthe Execute button. If you then wish to execute the first query, SELECT *
FROM Dependent, you may highlightthis query and clickon the Execute button. You can, of
course, do this as many times as you wish, and in any combination that you wish.
|