-
Notifications
You must be signed in to change notification settings - Fork 13
SQL block indentation
Tako Lee edited this page Feb 20, 2014
·
15 revisions
-
If SQL block of create function/procedure is a single statement
CREATE PROCEDURE humanresources.Uspgetallemployees AS SELECT lastname, firstname, jobtitle, department FROM humanresources.vemployeedepartment;
-
SQL block with BEGIN/END keyword
CREATE PROCEDURE humanresources.Uspgetallemployees AS BEGIN SELECT lastname, firstname, jobtitle, department FROM humanresources.vemployeedepartment; END
-
Specify indentation size of BEGIN/END keyword, indentation size of SQLs inside block related to BEGIN/END keyword.
CREATE PROCEDURE humanresources.Uspgetallemployees AS BEGIN SELECT lastname, firstname, jobtitle, department FROM humanresources.vemployeedepartment; END
-
BEGIN keyword can be specified not on a new line
IF @cost <= @compareprice BEGIN PRINT 'These products can be purchased for less than ' END ELSE PRINT 'The prices for all products in this category exceed '
-